while True:
try:
n=int(input())
for i in range(n):
a=int(input())
f=int(input())
if 0<= a <=9:
for m in range(f):
print()
for k in range(1,a+1):
for j in range(1,k+1):
print(k,end='')
print()
for q in range(a-1,0,-1):
for z in range(q+1,1,-1):
print(q,end='')
print()
except EOFError:
break
while True:
try:
n=int(input())
for i in range(n):
a=int(input())
f=int(input())
if 0<= a <=9:
for m in range(f):
print()
for k in range(1,a+1):
for j in range(1,k+1):
print(k,end='')
print()
for q in range(a-1,0,-1):
for z in range(q+1,1,-1):
print(q,end='')
print()
except EOFError:
break
第二列是空白行