struct node {
    int val;
    struct node *left, *right;
};

struct stack {
    const struct node *p;
    struct stack *next;
};

struct stack1 {
    const struct node **p;
    int size;
    int capacity;
};

void tree_push(struct node **p, int val);
void tree_insert(struct node **p, int val);
void tree_print(const struct node *p);

void stack_push(struct stack **s, const struct node *p);
const struct node *stack_pop(struct stack **s);

void stack_init1(struct stack1 *s, int capacity);
void stack_push1(struct stack1 *s, const struct node *p);
const struct node *stack_pop1(struct stack1 *s);
