Completed kruskal assignment with desired terminal output