Alice and Bob have a set of $N$ cards labelled with the numbers $1, 2, \ldots, N$ (no two cards share a label) and a shuffle machine. The number $N$ is odd.
The shuffle machine takes the cards arranged in an arbitrary order and performs the following double shuffle operation: for every position $i$ with $1 \le i \le N$, if the card at position $i$ is $j$ and the card at position $j$ is $k$, then after the double shuffle position $i$ holds card $k$.
Alice and Bob play a game. Alice first writes down the numbers from $1$ to $N$ in some random order $a_1, a_2, \ldots, a_N$. Then she arranges the cards so that position $a_i$ holds card $a_{i+1}$ for every $1 \le i \le N-1$, while position $a_N$ holds card $a_1$.
In this way the cards are placed in some order $x_1, x_2, \ldots, x_N$, where $x_i$ is the card at position $i$.
Alice then performs $S$ double shuffles in a row using the machine described above. Afterwards the cards are arranged in some final order $p_1, p_2, \ldots, p_N$, which Alice reveals to Bob together with the number $S$. Bob's task is to recover the order $x_1, x_2, \ldots, x_N$ in which Alice originally placed the cards just before handing them to the shuffle machine.
The first line contains two integers separated by a single space: the odd integer $N$ ($1 \le N \le 1000$), the number of cards, and the integer $S$ ($1 \le S \le 1000$), the number of double shuffle operations.
The following $N$ lines describe the final order of the cards after all double shuffles. For each $i$ with $1 \le i \le N$, the $(i+1)$-th line contains $p_i$, the card at position $i$ after all double shuffles.
Output $N$ lines describing the order of the cards just before they were given to the shuffle machine.
For each $i$ with $1 \le i \le N$, the $i$-th line contains $x_i$, the card at position $i$ before the double shuffles.