Galactik Football WA

Cant seem to find the error in my attempt at Galactik Football. https://www.codechef.com/viewsolution/17080397
I used union find.Can someone help me please