#include <stdio.h>
#include <stdlib.h>
typedef struct tree{
    int data;
    char name[20];
    struct tree *left;
    struct tree *right;
}nd;
nd *root=NULL;
nd *create(int val,char *a){
    nd *newnode=(nd*)malloc(sizeof(nd));
    newnode->data=val;
    strcpy(newnode->name,a);
    newnode->left=NULL;
    newnode->right=NULL;
    return newnode;
}
nd *insertBST(nd *root,int val,char *a){
    if(root==NULL){
        return create(val,a);
    }
    if(val<root->data){
        root->left=insertBST(root->left,val);
    }else{
        root->right=insertBST(root->right,val);
    }
    return root;
}
void lvlordtrav(nd *root){
    int queue[20];
    
}
int main(){
    int n;
    scanf("%d",&n);
    if(n<0){
        printf("Invalid input");
    }
    int t;char name[20];
    nd *root=NULL;
    for(int i=0;i<n;i++){
        scanf("%49[^,]%d",,name &t);
        if(t<0){
            printf("Invalid input");
            return 0;
        }
        root=insertBST(root,t,name);
    }
    lvlordtrav(root);
    return 0;
}