Help in Kruskal implementation in SPOJ problem

I was trying to do this question on SPOJ which is based on Kruskal’s Algo, but my code gives RE, could you please check out my code and tell where am i going wrong?
Problem: https://www.spoj.com/problems/BLINNET/
My Solution: https://ideone.com/drmNMY