A single-track playlist is stored as a singly linked list: each node holds an integer and points to the next node. You want to play it back to front, so you must reverse the chain and report the values in the new order (that is, the original list read from tail to head).
Input format
Line 1: an integer n, the number of nodes.
Line 2: n space-separated integers, the node values from head to tail (this line is empty when n is 0).
Output format
A single line with the n values after reversal, space-separated, from the new head to the new tail. If the list is empty, print EMPTY.
Constraints
- 0 <= n <= 100000
- -1000000000 <= each value <= 1000000000
- Values may repeat.