n = int(input()) l = list(map(int, input().split())) m = int(input()) while m in l: l.remove(m) print(' '.join(map(str, l)))