#K7936. Reverse a List

    ID: 35291 Type: Default 1000ms 256MiB

Reverse a List

Reverse a List

You are given a list of n integers. Your task is to reverse the order of these integers and output the reversed list. This problem is fundamental in understanding basic list operations and I/O handling in competitive programming.

The reversal can be mathematically viewed as finding a new sequence \(\{a_{n-1}, a_{n-2}, \ldots, a_0\}\) given the input sequence \(\{a_0, a_1, \ldots, a_{n-1}\}\.

inputFormat

The input is provided via stdin in the following format:

  • The first line contains a single integer n, representing the number of elements in the list.
  • The second line contains n space-separated integers.

outputFormat

Output the reversed list to stdout. The output should be a single line with the reversed sequence of integers separated by a single space.

## sample
5
1 2 3 4 5
5 4 3 2 1