#define N 3225 // Binary sort
void push(struct node **root, int n) {
  struct node *p = *root;
  if (p == NULL) {
    p = malloc(sizeof(struct node));
    p->n = n;
    p->left = p->right = NULL;
    *root = p;
    return;
  }
  if (n != p->n) {
    if (n < p->n) {
      push(&p->left, n);
    } else {
      push(&p->right, n);
    }
  }
}
int pop(struct node **root) {
  struct node *p = *root;
  int n;
  if (p == NULL)
    return -1;
  if (p->left)
    return pop(&p->left);
  assert(p->left == NULL);
  n = p->n;
  *root = p->right;
  free(p);
  return n;
}