Print Array in ReverseEasy

Print Array in Reverse

EasyPractice library · +10 XPbasicsarrays

Given a list of N integers, print the integers in reverse order. Each integer should be on a new line.

Input

The first line contains a single integer N, the number of integers. The second line contains N space-separated integers.

Output

Print N lines, where the i-th line contains the (N-i+1)-th integer from the input list.

Constraints

1 <= N <= 1000, -1000 <= a_i <= 1000

Time limit 1 s (native code; slower languages get more)Memory 256 MB12 hidden tests

Example 1

Input
5
1 2 3 4 5
Output
5
4
3
2
1

The input list is [1, 2, 3, 4, 5]. The reversed list is [5, 4, 3, 2, 1], and each element is printed on a new line.

Example 2

Input
3
10 20 30
Output
30
20
10

The input list is [10, 20, 30]. The reversed list is [30, 20, 10], printed on separate lines.

Hints