Collisions of Planetesimals and Formation of Planets