#include <stdio.h>
#include <stdlib.h>
struct Node {
    int data;
    struct Node *next;
};
struct Node* createNode(int value) {
    struct Node* newNode = (struct Node*)malloc(sizeof(struct Node));
    newNode->data = value;
    newNode->next = NULL;
    return newNode;
}
struct Node* removeGreater(struct Node* head, int max_height) {
    while (head != NULL && head->data > max_height) {
        struct Node* temp = head;
        head = head->next;
        free(temp);
    }
    struct Node* current = head;
    while (current != NULL && current->next != NULL) {
        if (current->next->data > max_height) {
            struct Node* temp = current->next;
            current->next = temp->next;
            free(temp);
        } else {
            current = current->next;
        }
    }
    return head;
}
void printList(struct Node* head) {
    if (head == NULL) {
        printf("Empty");
        return;
    }
    struct Node* temp = head;
    while (temp != NULL) {
        printf("%d ", temp->data);
        temp = temp->next;
    }
}
int main() {
    int n;
    scanf("%d", &n);
    if (n <= 0) {
        printf("Empty");
        return 0;
    }
    struct Node *head = NULL, *tail = NULL;
    for (int i = 0;i < n; i++) {
        int value;
        scanf("%d", &value);
        struct Node* newNode = create(value);
        if (head == NULL)
        head = tail = newNode;
        else {
            tail->next = newNode;
            tail = newNode;
        }
    }
    int max_height;
    scanf("%d", &max_height);
    head = removeGreater(head, max_height);
    printList(head);
    return 0;
}