#include<stdio.h>
#include<stdlib.h>
#include<string.h>


#define SIZE 100

typedef struct Node {
    int key;
    char value[50];
    struct Node* next;
} Node;

typedef struct {
    Node** buckets;
} HashMap;

Node* createNode(int key, const char* value) {
    Node* newNode = (Node*)malloc(sizeof(Node));
    newNode->key = key;
    strcpy(newNode->value, value);
    newNode->next = NULL;
    return newNode;
}

int hash(int key) {
    return abs(key) % SIZE;
}

HashMap* createHashMap() {
    HashMap* map = (HashMap*)malloc(sizeof(HashMap))
    map->buckets = ((Node**)calloc(SIZE, sizeof(Node*)));
    return map;
}

void add(HashMap* map, int key, const char* value) {
    int index = hash(key);
    Node* head = map->buckets[index];
    
    while (head != NULL) {
        if (head->key == key) {
            strcpy(head->value, value);
            return;
        }
        head = head->next;
    }
    
    Node* newNode = createNode(key, value);
    newNode->next = map->buckets[index];
    map->buckets[index] = newNode;
    printf("%d %s\n", key, value);
}
void find(HashMap* map, int key) {
    int index = hash(key);
    Node* head = map->buckets[index];
    while (head != NULL) {
        if (head->key == key) {
            printf("%s\n", head->value);
            return;
        }
        head = head->next;
    }
    printf("Element not found\n");
}

int main() {
    int n;
    if (scanf("%d", &n) != 1 || n < 0) {
        printf("Invalid input\n");
        return 1;
    }
    
    HashMap* map = createHashMap();
    char operation[10];
    int key;
    char value[50];
    
    for (int i = 0; i < n; i++) {
        scanf("%s", operation);
        if (strcmp(operation, "ADD") == 0) {
            scanf("%d %s", &key, value);
            add(map, key, value);
        } else if (strcmp(operation, "FIND") == 0) {
            scanf("%d", &key);
            find(map, key);
        }
    }
    
    free(map->buckets);
    free(map);
    
    return 0;
}