#include<stdio.h>
#include<stdlib.h>

#define MAX_SIZE 10000

typedef struct Citizen {
    int id; 
    char name[31];
    struct Citizen* next;
}Citizen;

Citizen* hashTable[MAX_SIZE + 1] = {NULL};
 
void addCitizen(int id, char* name) {
    Citizen*newCitizen = (Citizen*)malloc(sizeof(Citizen));
    newCitizen -> id = id;
    strcpy(newCitizen->name, name);
    newCitizen->next = hashTable[id];
    hashTable[id] = newCitizen;
}

void findCitizen(int id) {
    Citizen* Citizen = hashTable[id];
    if (Citizen != NULL) {
        printf("%s\n", Citizen -> name);
    }else {
        printf("Element not found\n");
    }
}
int main() {
    int n;
    scanf("%d",&n);
    
    if (n < 0) {
        printf("Invalid input\n");
        return 0;
    }
    
    for (int i = 0; i < n ; i++){
        char operation[10];
        int id;
        char name[31];
        scanf("%s %d %s", operation, &id, name);
        
        if (strcmp(operation, "ADD") == 0) {
            addCitizen(id,name);
            printf("s\n", name);
            
        } else if (strcmp(operation, "FIND") == 0) {
             findCitizen(id);
        }
    }
    for (int i = 0; i <=MAX_SIZE; i++) {
        Citizen* current = hashTable[i];
        whlie(current != NULL) {
            Citizen* next = current -> next;
            free(current);
            current = next;
        }
    }
    
    return 0;
}