code: @Override
      public int find(int x) {
          int curr = x;
          int currp = p[curr];
          while (curr != currp) {
              curr = currp;
              currp = p[curr];
          }
          return curr;
          // TODO: use path compression/halving/...?
      }
docs: Finds the set of a given element, and compresses the path to the root node.
  
  @param x
  the element
  
  @return the identifier of the set which contains the given element