@Override
    public T nextImpl() {
      while (last != null) {
        if (cur == null) {
          cur = max;
          max = max.next;
        }
        Iterator<? extends T> it = cur.iterator(tree);
        if (it.hasNext()) {
          T result = it.next();
          last = last.add(P2.create(result));
          last.parent = cur;
          cur = cur.prev;
          if (max == null) {
            max = last;
          }
          return result;
        }
        else {
          if (cur == last) {
            last = cur.prev;
          }
          cur = cur.remove();
        }
      }
      return stop();
    }
@Override
    public T nextImpl()