code: private void setDistinct(int leftSi, int rightSi) {
          IntArrayList tmp;
          int pair;
          int i, max;
  
          tmp = distinct[leftSi][rightSi];
          if (tmp != YES) {
              distinct[leftSi][rightSi] = YES;
              if (tmp != UNKNOWN) {
                  max = tmp.size();
                  for (i = 0; i < max; i++) {
                      pair = tmp.get(i);
                      setDistinct(left(pair), right(pair));
                  }
              }
          }
      }
docs: Mark the pair to be distinct. Recursively marks depending pairs.