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