#include <stdio.h>
#include <stdlib.h>

struct Node{
    int data;
    struct Node *next;
};

struct Node*head = NULL;
struct Node *tail = NULL;

void insertEnd(int value){
    struct Node *newNode = (struct Node *)malloc(sizeof(struct Node));
    newNode->data = value;
    newNode->next = NULL;
    
    if(head == NULL){
        head = tail = newNode;
    }else{
        tail->next=newNode;
        tail = newNode;
    }
}

int deleteByValue(int val){
    struct Node *temp = head;
    struct Node *prev = NULL;
    
    while(temp!=NULL){
        if(temp->data == val){
            if(prev == NULL){
                head = head->next;
                if(head == NULL)tail = NULL;
            }else{
                prev->next = temp->next;
                if(temp == tail) tail = prev;
            }
            free(temp);
            temp = temp->next;
        }
        return 0;
    }
    
    int main(){
        int n,x, toDelete;
        if (scanf("%d", &n) !=1) return 0;
        for(int i=0; i<n; i++){
            scanf("%d", &x);
            insertEnd(x);
        }
        scanf("%d", &toDelete);
        
        if(!deleteByValue(toDelete)){
            printf("Not Found");
            return 0;
        }
        struct Node*curr = head;
        while(curr != NULL){
            printf("%d", curr->data);
            if(curr->next != NULL) printf(" ");
            curr = curr->next;
        }
        return 0;
    }
}
}