11492 - rotate   

Description

Given an integer sequence, say {0, 1, 2, 3, 4, 5}, we can rotate the sequence to right 1 time and generate a new sequence.

Try to generate all possible results for the original sequence, and print the result by the order they show up.

For the example above, the output would be :

5 0 1 2 3 4

4 5 0 1 2 3

3 4 5 0 1 2

2 3 4 5 0 1

1 2 3 4 5 0

0 1 2 3 4 5 (loop occuring, stop output result from this on.)

 

Input

An integer sequence, separated by spaces. End by EOF.

Output

List all possible unique results generated from original sequence by rotation and output them by the order they show up .

Each line contains one sequence, where there is a space between each number.

Note that there is a '\n' at the end of each line.

Sample Input  Download

Sample Output  Download

Tags




Discuss