Program 5 - algorytm Kruskala i Prima