FIRESC, wrong answer

my solution is not working although it is working on the small size input . could someone tell my what is wrong ? I am using disjoint sets data structure.

I found my problem using the test case in link text . my disjoint sets implementation is wrong.