Dihedral and cyclic extensions with large class numbers