// editor4
    n = int(input())  # Read the number of elements
    sequence = []

    for _ in range(n):
        num = input()
        if not num.strip().isdigit():  # Check for non-numeric input
            print("Invalid input")
            exit()
        sequence.append(int(num))

    val = input()
    if not val.strip().isdigit():
        print("Invalid input")
        exit()
    val = int(val)

    if val not in sequence:
        print("Value not found")
    else:
        sequence.remove(val)
        if len(sequence) == 0:
            print("List is empty")
        else:
            print(" ".join(map(str, sequence)))

except Exception as e:
    print("Invalid input")