#include<stdio.h>
#include<stdlib.h>
#include<ctype.h>
#include<string.h>

#define MAX 100

struct node{
    int key;
    struct node*left;
    struct node*right;
    int height;
};

int height(struct node*n){
    if(n==NULL){
        return 0;
    }
    return n->height;
}

int max(inta,int b){
    return(a>b)?a:b;
}

struct node* newnode(int key){
    struct node*node=(struct node*)malloc(sizeof(struct node));
    node->key=key;
    node->left=NULL;
    node->right=NULL;
    node->height=1;
    return node;
}

struct node*rightrotate(struct node*y){
    struct node*x=y->left;
    struct node*t2=x->right;
    
    x->right=y;
    y->left=t2;
    
    y->height=max(height(y->left),height(y->right))+1;
    x->height=max(height(x->left),height(x->right))+1;
    
    return x;
}


struct node*lefrotate(struct node*x){
    struct*y=x->right;
    struct*t2=y->left;
    
    y->left=x;
    x->right=t2;
    
    x->height=max(height(x->left),height(x->right))+1;
    y->height=max(height(y->left),height(y->right))+1
    
    return y;
}

int getbalance(struct node*n){
    if(n=NULL){
        return 0;
    }
    return height(n->left)-height(n-right);
}

struct node*insert(struct node*noode,int key){
    if(noode==NULL){
        return newnoode(key);
    }
    if(key<node->key){
        node->left=insert(node->left,key);
    }
    else{
        node->right=in
    }
}