open input txt open output txt readline ln int list map str readline s

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
a=open("input.txt","r")
b=open('output.txt','w')
S=[]
s = a.readline()
ln = int(s)
k = (list(map(str , a.readline().split())))
while ln>0:
b.write(k[ln-1])
b.write(' ')
ln-=1
a.close()
b.close()