Implement Prim's algorithm by Python. Priority queue. O(mlogn)