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