
'''
ABCCDEABAA
ABCDE
'''

t, s = input(), input()

for i in range(len(s)):
    print()
    for j in range(len(s)):
        print(s[(i + j) % len(s)])
bcd03881a30a88ad5423446e8b2b803cb5e71a96
<mask token>

<mask token>
for i in range(len(s)):
    print()
    for j in range(len(s)):
        print(s[(i + j) % len(s)])

<mask token>
t, s = input(), input()
for i in range(len(s)):
    print()
    for j in range(len(s)):
        print(s[(i + j) % len(s)])


'''
ABCCDEABAA
ABCDE
'''

t, s = input(), input()

for i in range(len(s)):
    print()
    for j in range(len(s)):
        print(s[(i + j) % len(s)])