#K85767. Shuffle Cards Problem

    ID: 36715 Type: Default 1000ms 256MiB

Shuffle Cards Problem

Shuffle Cards Problem

You are given a deck of cards represented as a list of integers. The shuffling rule is as follows: for each card at an odd index (using 0-based indexing, i.e. positions 1, 3, 5, etc.), swap it with the adjacent card at the next even index (if such a card exists).

For example, if the deck is [1, 2, 3, 4, 5, 6], then after shuffling it becomes [1, 3, 2, 5, 4, 6].

Input is provided via standard input and the result should be printed to standard output.

inputFormat

The first line contains a single integer n indicating the number of cards in the deck. The second line contains n space-separated integers representing the deck.

outputFormat

Output the shuffled deck as n space-separated integers on one line.

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