// editor1
#include<stdio.h>
#include<stdlib.h>

typedef struct node{
    int data;
    struct node*next;
}node;
node*head=NULL,*tail;

void insertnode(int r){
    node*newnode=(node*)malloc(sizeof(node));
    newnode->data=r;
    newnode->next=NULL;
    if(head==NULL){
        head=newnode;
        tail=newnode;
    }
    else{
        tail->next=newnode;
        tail=newnode;
    }
}

int removenode(int max){
    node *temp=head,*check;
    if(head->data > max){
        head=NULL;
        printf("Empty");
        return 0;
    }
    while(temp!=NULL){
        else{
            if(temp->data < max){
                check=temp;
                temp=temp->next;
            }
            else{
                break;
            }
        }
        check->next=NULL;
    }
}

void display(){
    node *temp=head;
    while(temp!=NULL){
        printf("%d ",temp->data);
        temp=temp->next;
    }
}

int main(){
    int n,max,r;
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        scanf("%d",&r);
        insertnode(r);
    }
    scanf("%d",&max);
    removenode(max);
    display();
    return 0;
}