#include <iostream>
using namespace std;

int main() {
    int a, b[50], c,d[50];
    cin >> a;
    for (int i = 0; i < a; i++)
    {
        cin >> b[i];
    }
    cin >> c;
    for (int j = 0; j < a; j++)
    {
        if (b[j] == c)
        {
            b[j] = -1;

        }
    }
    for (int m = 0; m < a; m++)
    {
        if (b[m] != -1)
        {
            cout << b[m] << " ";
        }
    }
    return 0;
}
// 64 位输出请用 printf("%lld")