Python:
n=int(input())
first=list(map (int,input().split()))
m=int (input())
last=list(map(int, input().split()))
if(first [0]>first[-1]):
print (*last)
print(*first)
elif (last[0]>last[-1]):
print(*first)
print (*last)
elif (first [0]<first [-1]):
print(*first)
print(*last)
elif (last[0]<last[-1]):
print (*last)
print(*first)
elif (last [0]<first[0]):
print(*last)
print(*first)
else:
print (*first)
print(*last)
Post a Comment