Cascading Style Sheets problem : need help

i’m using C programming language and I don’t know why is this Runtime Error(SIGSEGV). Help

#include<stdio.h>
#include<stdlib.h>
#include<string.h>

struct node {
long long int id, attr;
long long int val, priority;
int height;
struct node *left;
struct node *right;
};

int max(int a, int b){
if (a < b) return b;
return a;
}

int getHeight(struct node *x){
if(x == NULL) return 0;
else return x->height;
}

int getBalFactor(struct node *x){
if(x == NULL) return 0;
return getHeight(x->left) - getHeight(x->right);
}

struct node *newNode(long long int id, long long int attr, long long int val, long long int priority){
struct node nNode = (struct node) malloc(sizeof(struct node));
nNode->id = id;
nNode->attr = attr;
nNode->val = val;
nNode->priority = priority;
nNode->left = nNode->right = NULL;
nNode->height = 1;
return nNode;
}

struct node *rightRotate(struct node *y){
struct node *x = y->left;
struct node *B = x->right;

x->right = y;
y->left = B;

y->height = max(getHeight(y->left), getHeight(y->right)) + 1;
x->height = max(getHeight(x->left), getHeight(x->right)) + 1;

return x;

}

struct node *leftRotate(struct node *x){
struct node *y = x->right;
struct node *B = y->left;

y->left = x;
x->right = B;

x->height = max(getHeight(x->left), getHeight(x->right)) + 1;
y->height = max(getHeight(y->left), getHeight(y->right)) + 1;

return y;

}

struct node *insertVal(struct node *root, long long int id, long long int attr, long long int val, long long int priority){
if(root == NULL) return newNode(id, attr, val, priority);
if(id < root->id){
root->left = insertVal(root->left, id, attr, val, priority);
}else if(id > root->id){
root->right = insertVal(root->right, id, attr, val, priority);
}
if(id == root->id && attr < root->attr){
root->left = insertVal(root->left, id, attr, val, priority);
}else if(id == root->id && attr > root->attr){
root->right = insertVal(root->right, id, attr, val, priority);
}
if(id == root->id && attr == root->attr){
if(priority >= root->priority){
if(val != root->val){
root->val = val;
root->priority = priority;
}
}
}

root->height = max(getHeight(root->left), getHeight(root->right)) + 1;
int bFactor = getBalFactor(root);

if(bFactor > 1 && id < root->left->id){
	return rightRotate(root);
}
if(bFactor < -1 && id > root->right->id){
	return leftRotate(root);
}
if(bFactor > 1 && id > root->left->id){
	root->left = leftRotate(root->left);
	return rightRotate(root);
}
if(bFactor < -1 && id < root->right->id){
	root->right = rightRotate(root->right);
	return leftRotate(root);
}

return root;

}

struct node *searchNode(struct node *root, long long int id, long long int attr){
if(id < root->id ){
if(root->left==NULL)
return NULL;
return searchNode(root->left, id, attr);
}
if(id > root->id ){
if(root->right==NULL)
return NULL;
return searchNode(root->right, id, attr);
}
if(id == root->id && attr < root->attr){
if(root->left==NULL)
return NULL;
return searchNode(root->left, id, attr);
}
if(id == root->id && attr > root->attr){
if(root->right==NULL)
return NULL;
return searchNode(root->right, id, attr);
}

return root;

}

int main(){
struct node *root = NULL;
long long int n,m;
long long int id, attr;
long long int val, priority;
scanf("%lld%lld",&n,&m);
for(int i=0;i<n;i++){
scanf("%lld%lld%lld%lld",&id, &attr, &val, &priority);
root = insertVal(root, id, attr, val, priority);
}
long long int idQuery, attrQuery;

for(int i=0;i<m;i++)
{
    scanf("%lld%lld",&idQuery, &attrQuery);
    struct node *temp = searchNode(root, idQuery, attrQuery);
    printf("%d\n",temp->val);
}
return 0;

}

//