Time limit per test: 0.75 second(s) Memory limit: 262144 kilobytes
input: standard output: standard
Consider a sequence of numbers a1, a2,..., an. Its cyclic shift is any sequence obtained from it by taking some (possibly none) of its starting elements and moving them to the end in the same order. In other words, it is a sequence ak, ak+1,..., an-1, an, a1, a2,..., ak-2, ak-1 for some k.
The smallest cyclic shift of a given sequence is its cyclic shift that is smallest lexicographically. A sequence is lexicographically smaller than another sequence of the same length if and only if it has a smaller number in the first position they differ.
Now, consider a sequence of integers a1, a2,..., an where 0 ≤ ai ≤ m-1, where m is some fixed constant. We define to be the sequence .
Given , m and an integer k between 1 and n, output m integer numbers: the k-th element of the smallest cyclic shift of , the k-th element of the smallest cyclic shift of ,..., the k-th element of the smallest cyclic shift of .
Input
The first line of the input file contains three integers n, m and k (, 1 ≤ k ≤ n). The second line of the input line contains n integers a1, a2,..., an (0 ≤ ai ≤ m-1).
Output
Output m integer numbers one per line — k-th elements of the smallest cyclic shifts of the sequences explained above.