int finds( int x ){
int r = x;
while( r != ft[r] ){
r = ft[r];
}
int j = x, t;
while( j != r ){
t = ft[j];
ft[j] = r;
j = t;
}
return r;
}
bool links( int a, int b ){
int ft1 = finds( a ), ft2 = finds( b );
if( ft1 != ft2 ){
ft[ft1] = ft2;
return false;
}
return true;
}