n, k, x = map(int, input().split())
a = list(map(int, input().split()))

# 前x张牌
front = a[:x]
back = a[x:]

# 循环右移 k 位
shift = k % x
new_front = front[-shift:] + front[:-shift]

result = new_front + back
print(' '.join(map(str, result)))