Skip to main content
Tuesday (24.11.2026) at 20:00: ALGOR Contest: Round #4 (Special Challenge) starts!

~/algor $ cat problems/massiv-teskari-tartib

Array in reverse order

Easy 1000 ms 128 MB 20%
Share

A positive integer $n$ and an array of $n$ integers are given. Print all its elements in reverse order:

$$a_{n}, \quad a_{n-1}, \quad \dots, \quad a_{1}$$

Reversing the order of the array elements

Input

The first line contains a positive integer $n$. The second line contains $n$ integers separated by spaces.

Output

One line with $n$ integers separated by spaces.

Note

$1 \le n \le 2 * 10^{5}$
$-10^{9} \le a_{i} \le 10^{9}$

Examples

Input #1
5
1 2 3 4 5
Output #1
5 4 3 2 1
Input #2
4
-7 0 12 3
Output #2
3 12 0 -7

Sign in to submit a solution

Signing up is free and takes a minute.