1. int find(int x) {
    2. if(x != arr[x]) {
    3. arr[x] = find(arr[x]);
    4. }
    5. return arr[x];
    6. }
    7. arr[find(a)] = find(b);