#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define size 30
typedef struct node{
    int key;
    char value[31];
    struct node* next;
}node;
node* hashtable[size];
int hashfun(int key){
    return key%size;
}

void add(int key,char* value){
    int index=hashfun(key);
    node *newnode=(node*)malloc(sizeof(node));
    newnode->key=key;
    strcpy(newnode->value,value);
    newnode->next=NULL;
    if(hashtable[index]==NULL){
        hashtable[index]=newnode;
    }else{
        node* temp = hashtable[index];
        while(temp!=NULL){
            temp=temp->next;
        }
        temp->next=newnode;
    }
    printf("%d %s\n",key,value);
    
}
void find(int key){
    int index=hashfun(key);
    node* temp=hashtable[index];
    while(temp!=NULL){
        if(temp->key==key){
            printf("%s\n",temp->value);
        }else{
            printf("Element not found");
        }
    }
}
int main(){
    int n;
    scanf("%d",&n);
    if(n<0){
        printf("Invalid input");
        return 0;
    }
    for(int i=0;i<n;i++){
        char opp[10];
        scanf("%s",opp);
        if(strcmp(opp,"ADD")==0){
            int key;
            char value[31];
            scanf("%d %s",&key,value);
            add(key,value);
        }
        else if(strcmp(opp,"FIND")==0){
            int key;
            scanf("%d",&key);
            find(key);
            
        }
    }
    return 0;
}