An extensive computer simulation of nucleic acid bases and Watson-Crick base pairs in a water cluster and DMSO cluster is performed by the Monte Carlo method. It is demonstrated that the unfavorable energetics of pair formation in a water cluster is determined by the significant destabilizing contribution of solvent to the energy of complex formation. It is shown that the formation of coplanar base pairs in a DMSO cluster is favorable. The DMSO cluster stabilizes A-U and A-T base pairs and the insignificant destabilization of the G-C base pair by a DMSO cluster is much less than the stabilization which occurs due to the attraction between bases.