#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define size 10
typedef struct node{
    int key;
    char value[11];
    struct Node* next;
}Node;

Node* hashTable[size];

int hashFunction(int key){
    return key%size;
}

void add(int key,char* value){
    int index=hashFunction(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->next != NULL){
            temp == temp->next;
        }
        temp->next==newNode;
    }
    printf("%d %s\n",key,value);
}
void find(int key){
    int index=hashFunction(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 operation[10];
        scanf("%s",operation);
        if(strcmp(operation,"ADD")==0){
            int key;
            char value[31];
            scanf("%d %s",&key,value);
            add(key,value);
        }
        else if(strcmp(operation,"FIND")==0){
            int key;
            scanf("%d",&key);
            find(key);
        }
    }
    return 0;
}
    
    
    
    
    
    
}