#include <stdio.h>
#include <stdlib.h>
struct Node {
    int data;
    struct Node *next;
};
int main() {   
    int n, x, del, found = 0;
    struct Node *head = NULL, *temp, *prev;
    scanf("%d", &n);
    for(int i = 0; i < n; i++) {
        scanf("%d", &x);
        temp = (struct Node*)malloc(sizeof(struct Node));
        temp->data = x;
        temp->next = NULL;
        if(!head)
        head=tail=temp;
        else{
            tail->next = temp;
            tail=temp;
        }
    }
    scanf("%d", &del);
    temp = head;
    while (temp) {
        if (temp->data == del) {
            found = 1;
            if (temp == head)
                head = head->next;
            else
                prev->next = temp->next;
            free(temp);
            break;
        }
        prev = temp;
        temp = temp->next;
    }
    if (!found) {
        printf("Not Found");
        return 0;
    }
    if (!head) {
        printf("List is empty");
        return 0;
    }
    temp = head;
    while (temp) {
        printf("%d ", temp->data);
        temp = temp->next;
    }
    return 0;
}