# https://www.acmicpc.net/problem/2675
import sys
T = int(sys.stdin.readline())
case = [sys.stdin.readline().strip().split(' ') for x in range(T)]
P = []
for i in range(T):
    tmp = ''
    for j in range(len(case[i][1])):
        for k in range(int(case[i][0])):
            tmp += case[i][1][j]
    P.append(tmp)
for i in range(T):
    print(P[i])

3d00dec6d2981187941c406d2eaf5193ee2a90fb
<mask token>

<mask token>
for i in range(T):
    tmp = ''
    for j in range(len(case[i][1])):
        for k in range(int(case[i][0])):
            tmp += case[i][1][j]
    P.append(tmp)
for i in range(T):
    print(P[i])

<mask token>
T = int(sys.stdin.readline())
case = [sys.stdin.readline().strip().split(' ') for x in range(T)]
P = []
for i in range(T):
    tmp = ''
    for j in range(len(case[i][1])):
        for k in range(int(case[i][0])):
            tmp += case[i][1][j]
    P.append(tmp)
for i in range(T):
    print(P[i])

import sys
T = int(sys.stdin.readline())
case = [sys.stdin.readline().strip().split(' ') for x in range(T)]
P = []
for i in range(T):
    tmp = ''
    for j in range(len(case[i][1])):
        for k in range(int(case[i][0])):
            tmp += case[i][1][j]
    P.append(tmp)
for i in range(T):
    print(P[i])

# https://www.acmicpc.net/problem/2675
import sys
T = int(sys.stdin.readline())
case = [sys.stdin.readline().strip().split(' ') for x in range(T)]
P = []
for i in range(T):
    tmp = ''
    for j in range(len(case[i][1])):
        for k in range(int(case[i][0])):
            tmp += case[i][1][j]
    P.append(tmp)
for i in range(T):
    print(P[i])
