Given $N$ numbers, print $N$ lines: the first is the original order, and each subsequent line rotates the whole sequence one step to the right (the last element moves to the front).
Input
Line 1: $N$ ($1 \le N \le 1000$). Line 2: $N$ integers in $[1, 1000]$.
Output
Print the $N$ successive right-rotations, one per line.
Example 1
Input
5 12 45 78 23 56
Output
12 45 78 23 56 56 12 45 78 23 23 56 12 45 78 78 23 56 12 45 45 78 23 56 12
Discussion
Threads about this problem. Spoilers are collapsed; wrap hints in
||double bars||.No discussion yet. Start a thread if something here needs explaining.