code: @Override
      public int link(int x, int y) {
          int rx = rank[x], ry = rank[y];
          if (rx > ry) {
              p[y] = x;
              return x;
          }
          p[x] = y;
          if (rx == ry) {
              rank[y] = ry + 1;
          }
          return y;
      }
docs: Unites two given sets. Note that the behavior of this method is not specified if the given parameters are normal
  elements and no set identifiers.
  
  @param x
  the first set
  @param y
  the second set
  
  @return the identifier of the resulting set (either {@code x} or {@code y})