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: SPOJ.com - Problem BLINNET
My Solution: drmNMY - Online C++ Compiler & Debugging Tool - Ideone.com