Solution to Kruskal and Hammilton problem - 4th semester