docs: public int union(int first, int second) {
      int firstComponent = find(first), secondComponent = find(second);
      if(firstComponent == secondComponent) {
        return firstComponent;
      }
      final int w1 = weight[firstComponent], w2 = weight[secondComponent];
      if(w1 > w2) {
        parent[secondComponent] = firstComponent;
        weight[firstComponent] += w2;
        return firstComponent;
      }
      else {
        parent[firstComponent] = secondComponent;
        weight[secondComponent] += w1;
        return secondComponent;
      }
    }