// editor4#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>

struct Node {
    char title[101];
    struct Node* next;
};

// Function to check if string has any digits
int hasDigits(char str[]) {
    for (int i = 0; str[i]; i++) {
        if (isdigit(str[i]))
            return 1;
    }
    return 0;
}

// Function to create a new node
struct Node* createNode(char str[]) {
    struct Node* newNode = (struct Node*)malloc(sizeof(struct Node));
    strcpy(newNode->title, str);
    newNode->next = NULL;
    return newNode;
}

int main() {
    int n;
    scanf("%d", &n);

    if (n < 1 || n > 500) {
        printf("Invalid Input\n");
        return 0;
    }

    getchar(); // to consume newline after integer input
    struct Node* head = NULL;
    struct Node* tail = NULL;

    char temp[101];

    // Read book titles
    for (int i = 0; i < n; i++) {
        fgets(temp, sizeof(temp), stdin);
        temp[strcspn(temp, "\n")] = '\0'; // remove newline

        if (hasDigits(temp)) {
            printf("Invalid Input\n");
            return 0;
        }

        struct Node* newNode = createNode(temp);
        if (head == NULL)
            head = tail = newNode;
        else {
            tail->next = newNode;
            tail = newNode;
        }
    }

    // Read search title
    fgets(temp, sizeof(temp), stdin);
    temp[strcspn(temp, "\n")] = '\0';

    if (hasDigits(temp)) {
        printf("Invalid Input\n");
        return 0;
    }

    // Search in linked list
    struct Node* current = head;
    int pos = 1, found = 0;
    while (current != NULL) {
        if (strcmp(current->title, temp) == 0) {
            printf("Found at position %d\n", pos);
            found = 1;
            break;
        }
        current = current->next;
        pos++;
    }

    if (!found)
        printf("Not Found\n");

    return 0;
}