#include <iostream>
using namespace std;
int i ;
int num[50];
typedef struct Treenode {
int data;
struct Treenode* lchild;
struct Treenode *rchild;
}Treenode,*Tree;
void Insert(Tree &T, int e) {
if (T == NULL) {
T = new Treenode;
T->data = e;
T->lchild = NULL;
T->rchild = NULL;
}
else
{
if (e < T->data)
Insert(T->lchild, e);
else
Insert(T->rchild, e);
}
}
void Largex(Tree &T, int x) {
if (T) {
Largex(T->lchild, x);
num[i++] = T->data;
Largex(T->rchild, x);
}
}
int main() {
int n;
while (cin >> n && n != 0) {
Tree T=NULL;
for (int i = 0; i < n; i++) {
int e;
cin >> e;
Insert(T, e);
}
int x;
cin >> x;
Largex(T, x);
for (int i = 0; i < n-1; i++) {
if (num[i] >= x) {
cout << num[i]<<" ";
}
}
cout << num[n - 1];
cout << endl;
num[50] = { 0 };
i = 0;
}
}