The goal of this science case is to address the use of a ngVLA as a CO redshift machine for dust-obscured high-redshift galaxies which lack of clear counterparts at other wavelengths. Thanks to its unprecedentedly large simultaneous bandwidth and sensitivity, the ngVLA will be able to detect low--J CO transitions at virtually any $z>1$. In particular, at $z>4.76$ two CO transitions will be covered in a single frequency setting, thus ensuring unambiguous line identification. The ngVLA capabilities fill in a redshift range where other approaches (e.g., photometric redshifts, search for optical/radio counterparts, etc) typically fail due to the combination of intrinsically faint emission and increasing luminosity distance. This will allow us to explore the formation of massive galaxies in the early cosmic times.