Mass spectra of the ground-state baryons consisting of three or two heavy (b or c) and one light (u, d, s) quarks are calculated in the framework of the relativistic quark model and the hyperspherical expansion. The predictions of masses of the triply and doubly heavy baryons are obtained by employing the perturbation theory for the spin-independent and spin-dependent parts of the three-quark Hamiltonian. The transition from two-quark bound states to three-quark bound states opens new problems which refer both to the form of the quark interaction in the baryon and the structure of three-quark relativistic wave equation describing this system. In general form they were studied and solved already by many authors [1,2,3,4,5,6,7,8] (see other references in Ref.[6]). In practice it is important to have an approach which can allow to obtain simple and reliable estimates for the different experimental quantities regarding to the baryon spectroscopy, the production and decay rates. Whereas heavy baryons with one or two heavy quarks were investigated both theoretically and experimentally, the triply heavy baryons Ω Q 1 Q 2 Q 3 containing b− and c− quarks have not studied so much. The estimate of masses of the lowest-lying (ccc), (ccb), (bbc) and (bbb) states is presented in Refs. [9,10,11]. Their production in a c− or b− quark fragmentation is calculated in Refs. [12,13]. The doubly heavy baryons (Q 1 Q 2 q) represent a unique part of three-quark systems. Two heavy quarks compose a localized quark nucleus while the light quark moves around this color source at a distance of order (1/m q ). This picture leads to the quark-diquark model for doubly heavy baryons which was used in Refs. [14,15,16] for the description of the mass spectrum and decay widths. Moreover, relativistic and bound state corrections to the mass spectra of mesons and baryons (in the quark-diquark approximation) and their different decay rates were also considered in the relativistic quark model [14,15,16,17,18]. Estimates for the masses of baryons containing two heavy quarks have been presented by many authors [4,19,20,21,22,23] using different QCD inspired models for the quark interactions. The aim of the present paper is a twofold one. First, we go beyond the scope of the quark-diquark approximation in Refs. [14,15] treating the total baryon Hamiltonian as a sum of two-quark interactions and using the hyperradial approximation for the ground state triply and doubly heavy baryons. Secondly, we take into account relativistic and bound state corrections of order v 2 /c 2 by the perturbation theory. So, the purpose of our new investigation consists in the elaboration of an alternative calculational scheme of the baryon mass spectrum as compared with the earlier performed investigations in Refs. [14,15] through the use of *