We report an ab initio investigation of several structures of pristine Si and Ge nanowires with diameters between 0.5 and 2.0 nm. We consider nanowires based on the diamond structure, high-density bulk structures, and fullerenelike structures. Our calculations indicate a transition from sp3 geometries to structures with higher coordination, for diameters below 1.4 nm. We find that diamond-structure nanowires are unstable for diameters smaller than 1 nm, undergoing considerable structural transformations towards amorphouslike wires. For diameters between 0.8 and 1 nm, filled-fullerene wires are the most stable. For even smaller diameters (approximately 0.5 nm), we find that a simple hexagonal structure is particularly stable for both Si and Ge.