n = int(input("n = "))
numbers = []
for i in range(n):
a = int(input("add number to the list: "))
if a < 0:
numbers.append(a)
if len(numbers) > 0:
for i in range(len(numbers)-1, -1, -1):
print(numbers[i], end=" ")
else:
print("NO")
n = int(input("n = "))
numbers = []
for i in range(n):
a = int(input("add number to the list: "))
if a < 0:
numbers.append(a)
if len(numbers) > 0:
for i in range(len(numbers)-1, -1, -1):
print(numbers[i], end=" ")
else:
print("NO")