A queue of ticket numbers is stored as a singly linked list, front to back. Fold the queue by alternating between the front and the back: first take the front ticket, then the back ticket, then the new front, then the new back, and so on, until every ticket has been placed exactly once. Print the resulting order.
Input format
Line 1: an integer n — the number of tickets.
Line 2: n space-separated integers — the ticket numbers, front to back.
Output format
n space-separated integers: the folded order.
Constraints
- 1 ≤ n ≤ 100000
- -1000000000 ≤ ticket number ≤ 1000000000