import sys
import numpy

def parser():
    while 1:
        data = list(input().split(' '))
        for number in data:
            if len(number) > 0:
                yield(number)

input_parser = parser()

def get_word():
    global input_parser
    return next(input_parser)

def get_number():
    data = get_word()
    try:
        return int(data)
    except ValueError:
        return float(data)

def generate_word(n, long_word):
    target = ''
    counter = 0
    while(n != 0):
        target = target + long_word[counter]
        long_word = long_word[1:]
        n = n-1
        counter = counter + 1
    print(target)

test_cases = get_number()
for i in range(0, test_cases):
    n = get_number()
    long_word = get_word()
    generate_word(n, long_word)


import sys

def parser():
    while 1:
        data = list(input().split(' '))
        for number in data:
            if len(number) > 0:
                yield(number)

input_parser = parser()

def get_word():
    global input_parser
    return next(input_parser)

def get_number():
    data = get_word()
    try:
        return int(data)
    except ValueError:
        return float(data)

def generate_word(n, long_word):
    target = ''
    counter = 0
    while(n != 0):
        target = target + long_word[counter]
        long_word = long_word[1:]
        n = n-1
        counter = counter + 1
    print(target)

test_cases = get_number()
for i in range(0, test_cases):
    n = get_number()
    long_word = get_word()
    generate_word(n, long_word)


import sys

def parser():
    while 1:
        data = list(input().split(' '))
        for number in data:
            if len(number) > 0:
                yield(number)

input_parser = parser()

def get_word():
    global input_parser
    return next(input_parser)

def get_number():
    data = get_word()
    try:
        return int(data)
    except ValueError:
        return float(data)

def generate_word(n, long_word):
    target = ''
    counter = 0
    while(n != 0):
        target = target + long_word[0]
        long_word = long_word[1:]
        n = n-1
        counter = counter + 1
    print(target)

test_cases = get_number()
for i in range(0, test_cases):
    n = get_number()
    long_word = get_word()
    generate_word(n, long_word)


for _ in range(int(input())):
    n=int(input())
    s=input()
    w=[]
    for i in s:
        if len(w)>n-1:
            break
        else:
            w.append(int(i))
    for i in range(n):
        print(w[i],end="")


for _ in range(int(input())):
    n=int(input())
    s=input()
    for i in range(n):
        print(s[2*i],end="")
    print()


for _ in range(int(input())):
    n=int(input())
    s=input()
    w=[]
    for i in s:
        if len(w)>n-1:
            break
        else:
            w.append(int(i))
    for i in range(n-1):
        print(w[i],end="")
    print(w[n-1])


# t = int(input()[2:])
# s = input()
# while t:s = s.replace('BG','GB');t-=1
# print (s)

# t = int(input())
# n = [0 for x in range(0, t)]
# for i in range(t):
#     n[i] = int(input())
# for i in n:
#     if i % 4 != 0:
#         print("No")
#     else:
#         print('YES')
#         print(*range(2,i+1,2),*range(1,i-1,2),(i*3)//2-1)
# t = int(input())
# for i in range(t):
#     s = input().split()
#     x = int(s[0])
#     y = int(s[1])
#     print( 0 if x==1 else y if x==2 else y*2 if x > 2 else '')
# t = int(input())
# for i in range(t):
#     j = input().split()
#     l = int(j[0])
#     s = int(j[1])
#     d = int(j[2])
#     print(''.join(chr(97+j%d) for j in range(l)))
# t =int(input())
# for i in range(t):
#     s = input().split()
#     b = int(s[1])
#     c = int(s[2])
#     print(b,c,c)
# t = int(input())
# for i in range(t):
#     print('1' * int(input()))
# t = int(input())
# x = [0 for i in range(t)]
# for j in range(t):
#     x[j] = int(input())
# for s in range(t):
#     print( '1 1' if x[s]==2 else '2 '+f'{x[s]-2}' if  x[s]%2 == 0 else '1 '+f'{x[s]-1}')
# t = int(input())
# x = [0 for i in range(t*2)]
# for j in range(0,t*2,2):
#      s = input().split()
#      x [j] = int(s[0])
#      x [j+1] = int(s[1])
# for i in range(0,t*2,2):
#     if x[i]*2 <= x[i+1]:
#         print(f'{x[i]} '+f'{ x[i]*2}')
#     else:
#         print('-1 -1')
# print( f'{x[i]} '+f'{ x[i]*2}' if x[i]*2 <= x[i+1] else '-1 -1' for i in range(0,t*2,2) )
# print(n[x] for x in n)

# i = int(input())
# print('NO' if   (i%2!=0)  else 'YES' if i>2 else 'NO')
# i = int(input())
# s = ['' for z in  range(i)]
# for j in range(i):
#     x = input()
#     s[j] = x
# for j in range(i):
#     print(f'{s[j][0]}'+f'{len(s[j])-2}'+f'{s[j][len(s[j])-1]}' if len(s[j])>10 else s[j])

# i = input().split()
# if int(i[0]) % int(i[2]) == 0:
#     a = int(i[0]) // int(i[2])
# else:
#     a = int(i[0]) // int(i[2]) + 1
# if int(i[1]) % int(i[2]) == 0:
#     b = int(i[1]) // int(i[2])
# else:
#     b = int(i[1]) // int(i[2]) + 1
# print(a*b)
t = int(input())
s = ['' for x in range(t)]
for j in range(t):
    x = int(input())
    s[j] = input()
for j in range(t):
    if len(s[j]) == 1:
        print(s[j])
    elif len(s[j]) == 3:
        print(s[j][0]+s[j][2])
    else:
        L = (len(s[j])+1)//2
        print(''.join(s[j][k] for k in range(L)))

# for j in range(1, 1001):
#     if (j*k)%10 == 0 :
#         print(j)
#         break
#     else:
#         if (j*k)%10 == r:
#             print(j)
#             break

# print(237%10)
# j = 0
# s = [0 for x in range(0, 27)]
# for i in a:
#     if i.isalpha():
#         s[ord(i) - 97] += 1
# for x in s:
#     if x != 0:
#         j += 1
# print(j)


# t = int(input()[2:])
# s = input()
# while t:s = s.replace('BG','GB');t-=1
# print (s)

# t = int(input())
# n = [0 for x in range(0, t)]
# for i in range(t):
#     n[i] = int(input())
# for i in n:
#     if i % 4 != 0:
#         print("No")
#     else:
#         print('YES')
#         print(*range(2,i+1,2),*range(1,i-1,2),(i*3)//2-1)
# t = int(input())
# for i in range(t):
#     s = input().split()
#     x = int(s[0])
#     y = int(s[1])
#     print( 0 if x==1 else y if x==2 else y*2 if x > 2 else '')
# t = int(input())
# for i in range(t):
#     j = input().split()
#     l = int(j[0])
#     s = int(j[1])
#     d = int(j[2])
#     print(''.join(chr(97+j%d) for j in range(l)))
# t =int(input())
# for i in range(t):
#     s = input().split()
#     b = int(s[1])
#     c = int(s[2])
#     print(b,c,c)
# t = int(input())
# for i in range(t):
#     print('1' * int(input()))
# t = int(input())
# x = [0 for i in range(t)]
# for j in range(t):
#     x[j] = int(input())
# for s in range(t):
#     print( '1 1' if x[s]==2 else '2 '+f'{x[s]-2}' if  x[s]%2 == 0 else '1 '+f'{x[s]-1}')
# t = int(input())
# x = [0 for i in range(t*2)]
# for j in range(0,t*2,2):
#      s = input().split()
#      x [j] = int(s[0])
#      x [j+1] = int(s[1])
# for i in range(0,t*2,2):
#     if x[i]*2 <= x[i+1]:
#         print(f'{x[i]} '+f'{ x[i]*2}')
#     else:
#         print('-1 -1')
# print( f'{x[i]} '+f'{ x[i]*2}' if x[i]*2 <= x[i+1] else '-1 -1' for i in range(0,t*2,2) )
# print(n[x] for x in n)

# i = int(input())
# print('NO' if   (i%2!=0)  else 'YES' if i>2 else 'NO')
# i = int(input())
# s = ['' for z in  range(i)]
# for j in range(i):
#     x = input()
#     s[j] = x
# for j in range(i):
#     print(f'{s[j][0]}'+f'{len(s[j])-2}'+f'{s[j][len(s[j])-1]}' if len(s[j])>10 else s[j])

# i = input().split()
# if int(i[0]) % int(i[2]) == 0:
#     a = int(i[0]) // int(i[2])
# else:
#     a = int(i[0]) // int(i[2]) + 1
# if int(i[1]) % int(i[2]) == 0:
#     b = int(i[1]) // int(i[2])
# else:
#     b = int(i[1]) // int(i[2]) + 1
# print(a*b)
t = int(input())
s = ['' for x in range(t)]
for j in range(t):
    x = int(input())
    s[j] = input()
for j in range(t):
    print(''.join(s[j][k] for k in range(0,len(s[j]),2)))

# for j in range(1, 1001):
#     if (j*k)%10 == 0 :
#         print(j)
#         break
#     else:
#         if (j*k)%10 == r:
#             print(j)
#             break

# print(237%10)
# j = 0
# s = [0 for x in range(0, 27)]
# for i in a:
#     if i.isalpha():
#         s[ord(i) - 97] += 1
# for x in s:
#     if x != 0:
#         j += 1
# print(j)


# t = int(input()[2:])
# s = input()
# while t:s = s.replace('BG','GB');t-=1
# print (s)

# t = int(input())
# n = [0 for x in range(0, t)]
# for i in range(t):
#     n[i] = int(input())
# for i in n:
#     if i % 4 != 0:
#         print("No")
#     else:
#         print('YES')
#         print(*range(2,i+1,2),*range(1,i-1,2),(i*3)//2-1)
# t = int(input())
# for i in range(t):
#     s = input().split()
#     x = int(s[0])
#     y = int(s[1])
#     print( 0 if x==1 else y if x==2 else y*2 if x > 2 else '')
# t = int(input())
# for i in range(t):
#     j = input().split()
#     l = int(j[0])
#     s = int(j[1])
#     d = int(j[2])
#     print(''.join(chr(97+j%d) for j in range(l)))
# t =int(input())
# for i in range(t):
#     s = input().split()
#     b = int(s[1])
#     c = int(s[2])
#     print(b,c,c)
# t = int(input())
# for i in range(t):
#     print('1' * int(input()))
# t = int(input())
# x = [0 for i in range(t)]
# for j in range(t):
#     x[j] = int(input())
# for s in range(t):
#     print( '1 1' if x[s]==2 else '2 '+f'{x[s]-2}' if  x[s]%2 == 0 else '1 '+f'{x[s]-1}')
# t = int(input())
# x = [0 for i in range(t*2)]
# for j in range(0,t*2,2):
#      s = input().split()
#      x [j] = int(s[0])
#      x [j+1] = int(s[1])
# for i in range(0,t*2,2):
#     if x[i]*2 <= x[i+1]:
#         print(f'{x[i]} '+f'{ x[i]*2}')
#     else:
#         print('-1 -1')
# print( f'{x[i]} '+f'{ x[i]*2}' if x[i]*2 <= x[i+1] else '-1 -1' for i in range(0,t*2,2) )
# print(n[x] for x in n)

# i = int(input())
# print('NO' if   (i%2!=0)  else 'YES' if i>2 else 'NO')
# i = int(input())
# s = ['' for z in  range(i)]
# for j in range(i):
#     x = input()
#     s[j] = x
# for j in range(i):
#     print(f'{s[j][0]}'+f'{len(s[j])-2}'+f'{s[j][len(s[j])-1]}' if len(s[j])>10 else s[j])

# i = input().split()
# if int(i[0]) % int(i[2]) == 0:
#     a = int(i[0]) // int(i[2])
# else:
#     a = int(i[0]) // int(i[2]) + 1
# if int(i[1]) % int(i[2]) == 0:
#     b = int(i[1]) // int(i[2])
# else:
#     b = int(i[1]) // int(i[2]) + 1
# print(a*b)
t = int(input())
s = ['' for x in range(t)]
for j in range(t):
    x = int(input())
    s[j] = input()
for j in range(t):
    if len(s[j]) == 1:
        print(s[j])
    else:
        L = (len(s[j])+1)//2
        print(''.join(s[j][k] for k in range(L)))

# for j in range(1, 1001):
#     if (j*k)%10 == 0 :
#         print(j)
#         break
#     else:
#         if (j*k)%10 == r:
#             print(j)
#             break

# print(237%10)
# j = 0
# s = [0 for x in range(0, 27)]
# for i in a:
#     if i.isalpha():
#         s[ord(i) - 97] += 1
# for x in s:
#     if x != 0:
#         j += 1
# print(j)


t=int(input())
while(t):
    n=int(input())
    s=input()
    if(len(s)==1):
        print(s)
    else:
        print(s[n-1:2*n-1]
    t-=1


t=int(input())
while(t--):
    n=int(input())
    s=input()
    if(len(s)==1):
        print(s)
    else:
        print(s[n-1:2*n-1]
    t-=1


# cook your dish here
t=int(input())
while(t):
    n=int(input())
    s=input()
    ans=""
    if(len(s)==1):
        print(s)
    else:
        for i in range(0,len(s),2):
            ans+=s[i]
        print(ans)
    t-=1


for _ in range(int(input())):
    n = int(input())
    s = input()
    ans = s[0]
    for i in range(1,n):
        if ans[0] == s[i]:
            continue
        j = i+1
        k = 1
        flag = 0
        while k < len(ans):
            if ans[k] == s[j]:
                flag = 1
                break
            k += 1
            j += 1
        if flag == 0:
            ans += s[j]
    ans += "0"*(n-len(ans))
    print(ans)


# class solution:
#     def ans(self, s):
#         n = len(s)
#         m = (n+1)//2
#         return s[:m]

for _ in range(int(input())):
    n = int(input())
    s = input()
    n = len(s)
    m = (n+1)//2
    print(s[:m])
    # obj = solution()
    # ans = obj.ans(s)
    # print(ans)


class solution:
    def ans(self, s):
        n = len(s)
        m = (n+1)//2
        return s[:m]

for _ in range(int(input())):
    n = int(input())
    s = input()
    obj = solution()
    ans = obj.ans(s)
    print(ans)


for _ in range(int(input())):
    n=int(input())
    s=input()
    c=[]
    for i in range(len(s)):
        if i%2==0:
            c+=s[i]
    str=""
    for e in c:
        str+=e
    print(str)


for _ in range(int(input())):
    n=int(input())
    s=input()
    c=[]
    for i in range(len(s)):
        if i%2==0:
            c+=s[i]
    print(c)


for _ in range(int(input())):
    n=int(input())
    s=input()
    c=""
    for i in range(len(s)):
        if i%2==0:
            c+=s[i]
    print(c)


for _ in range(int(input())):
    n=int(input())
    s=input()
    c=[]
    for i in range(len(s)):
        if i%2==0:
            c+=s[i]
    print(str(c))


t=int(input())
while(t):
    n=int(input())
    s=input()
    out=''
    for i in range(0,len(s),2):
        out=out+s[i]
    print(out)
    t=t-1


t=int(input())
while(t):
    n=int(input())
    s=input()
    out=''
    for i in range(len(s),2):
        out=out+s[i]
    print(out)
    t=t-1


t=int(input())
while(t):
    n=int(input())
    s=input()
    out=''
    for i in range(n):
        out=out+s[i]
    print(out)
    t=t-1


import collections
import math
# 011011
#
def sort(key):
	return key[1]
def pack(key):
	return key[0]

def gcd(a,b):
	if b ==0 :
		return a
	else:
		return gcd(b,a%b)
def solve(l,p):
	if l==2 and p[0] != p[l-1]:
		return p[0]+p[0]
	elif l==2 and p[0] == p[l-1]:
		return p[0]+p[l-1]
	if l<=1:
		return p

	if p[0]=='1':
		return p[0]+('0'*(l-2))+p[l-1]
	return p[0]+('1'*(l-2))+p[l-1]

k = int(input())
for i in range(k):
	l = int(input())
	p = input()
	print(solve(l,p))
# c=-1
# for i in range(len(ar)-1):
# 	if ar[i][1]==ar[i+1][1]:
# 		c=i
# 	else:
# 		m = ar[c:i+1]
# 		m=sorted(m,key=pack)
# 		ar[c:i+1]=m


import collections
import math
# 011011
#
def sort(key):
	return key[1]
def pack(key):
	return key[0]

def gcd(a,b):
	if b ==0 :
		return a
	else:
		return gcd(b,a%b)
def solve(l,p):
	if l<=1:
		return p
	if p[0] == p[len(p)-1]:
		return p[0]*l
	if p[0] != p[len(p)-1] and len(p)>2:
		return p[0]+ ('0'*(l-2)) +p[len(p)-1]
	return p[0]+p[len(p)-1]
k = int(input())
for i in range(k):
	l = int(input())
	p = input()
	print(solve(l,p))
# c=-1
# for i in range(len(ar)-1):
# 	if ar[i][1]==ar[i+1][1]:
# 		c=i
# 	else:
# 		m = ar[c:i+1]
# 		m=sorted(m,key=pack)
# 		ar[c:i+1]=m


import collections
import math
# 011011
#
def sort(key):
	return key[1]
def pack(key):
	return key[0]

def gcd(a,b):
	if b ==0 :
		return a
	else:
		return gcd(b,a%b)
def solve(l,p):
	if l<=1:
		return p
	if p[0] == p[len(p)-1]:
		return p[0]*l
	if p[0] != p[l-1] and l>2:
		return p[0]+ ('0'*(l-2)) +p[l-1]
	return p[0]+p[l-1]
k = int(input())
for i in range(k):
	l = int(input())
	p = input()
	print(solve(l,p))
# c=-1
# for i in range(len(ar)-1):
# 	if ar[i][1]==ar[i+1][1]:
# 		c=i
# 	else:
# 		m = ar[c:i+1]
# 		m=sorted(m,key=pack)
# 		ar[c:i+1]=m


import collections
import math
# 011011
#
def sort(key):
	return key[1]
def pack(key):
	return key[0]

def gcd(a,b):
	if b ==0 :
		return a
	else:
		return gcd(b,a%b)
def solve(l,p):
	if l<=1:
		return p
	cut=[i for i in p[0:l]]
	for x in range(len(p)):
		ok=0
		en=0
		ind=0
		c=0
		for i in range(x,l+x):
			if i > abs(x-l):
				break
			en+=1
			if cut[c]==p[i]:
				ok=1
				break
			if cut[c]!=p[i]:
				ind=c
			c+=1
		if not ok and en>0:
			if cut[ind]=='1':
				cut[ind]='0'
			else:
				cut[ind]='1'
	return ''.join(cut)
k = int(input())
for i in range(k):
	l = int(input())
	p = input()
	print(solve(l,p))
# c=-1
# for i in range(len(ar)-1):
# 	if ar[i][1]==ar[i+1][1]:
# 		c=i
# 	else:
# 		m = ar[c:i+1]
# 		m=sorted(m,key=pack)
# 		ar[c:i+1]=m


import collections
import math
# 011011
#
def sort(key):
	return key[1]
def pack(key):
	return key[0]

def gcd(a,b):
	if b ==0 :
		return a
	else:
		return gcd(b,a%b)
def solve(l,p):
	if l <=1:
		return l

	return '1'+('0'*(l-1))
k = int(input())
for i in range(k):
	l = int(input())
	p = input()
	print(solve(l,p))
# c=-1
# for i in range(len(ar)-1):
# 	if ar[i][1]==ar[i+1][1]:
# 		c=i
# 	else:
# 		m = ar[c:i+1]
# 		m=sorted(m,key=pack)
# 		ar[c:i+1]=m


import collections
import math
# 011011
#
def sort(key):
	return key[1]
def pack(key):
	return key[0]

def gcd(a,b):
	if b ==0 :
		return a
	else:
		return gcd(b,a%b)
def solve(l,p):
	if l<=1:
		return p
	if l == 2:
		return p[0]*l
	return p[0:l]
k = int(input())
for i in range(k):
	l = int(input())
	p = input()
	print(solve(l,p))
# c=-1
# for i in range(len(ar)-1):
# 	if ar[i][1]==ar[i+1][1]:
# 		c=i
# 	else:
# 		m = ar[c:i+1]
# 		m=sorted(m,key=pack)
# 		ar[c:i+1]=m


import collections
import math
# 011011
#
def sort(key):
	return key[1]
def pack(key):
	return key[0]

def gcd(a,b):
	if b ==0 :
		return a
	else:
		return gcd(b,a%b)
def solve(l,p):
	if l<=1:
		return p
	if l == 2:
		return p[0]*l
	ones=0
	for i in range(l):
		if p[i]=='1':
			ones+=1
	if ones==0:
		return '0'*l
	elif ones==l:
		return '1'*l
	return '1'+ ('1'*(l-2))+'0'
k = int(input())
for i in range(k):
	l = int(input())
	p = input()
	print(solve(l,p))
# c=-1
# for i in range(len(ar)-1):
# 	if ar[i][1]==ar[i+1][1]:
# 		c=i
# 	else:
# 		m = ar[c:i+1]
# 		m=sorted(m,key=pack)
# 		ar[c:i+1]=m


import collections
import math
# 011011
#
def sort(key):
	return key[1]
def pack(key):
	return key[0]

def gcd(a,b):
	if b ==0 :
		return a
	else:
		return gcd(b,a%b)
def solve(l,p):
	if l<=1:
		return p
	ones=0
	zeros=0
	mxOnes=0
	mxZeros=0
	for i in range(len(p)):
		if zeros>mxZeros:
			mxZeros=zeros
		if ones>mxOnes:
			mxOnes=ones
		if p[i] == '1':
			zeros=0
			ones+=1
		else:
			ones=0
			zeros+=1
	if zeros>mxZeros:
		mxZeros=zeros
	if ones>mxOnes:
		mxOnes=ones
	if mxZeros > mxOnes:
		return '0'*l
	else:
		return '1'*l
k = int(input())
for i in range(k):
	l = int(input())
	p = input()
	print(solve(l,p))
# c=-1
# for i in range(len(ar)-1):
# 	if ar[i][1]==ar[i+1][1]:
# 		c=i
# 	else:
# 		m = ar[c:i+1]
# 		m=sorted(m,key=pack)
# 		ar[c:i+1]=m


import collections
import math
# 011011
#
def sort(key):
	return key[1]
def pack(key):
	return key[0]

def gcd(a,b):
	if b ==0 :
		return a
	else:
		return gcd(b,a%b)
def solve(l,p):
	if l<=1:
		return p
	cut=[i for i in p[0:l]]
	for x in range(len(p)):
		ok=0
		en=0
		ind=0
		c=0
		for i in range(x,l+x):
			if c>=len(cut) or l+x>=len(p):
				break
			en+=1
			if cut[c]==p[i]:
				ok=1
				break
			if cut[c]!=p[i]:
				ind=c
			c+=1
		if not ok and en>0:
			if cut[ind]=='1':
				cut[ind]='0'
			else:
				cut[ind]='1'
	return ''.join(cut)
k = int(input())
for i in range(k):
	l = int(input())
	p = input()
	print(solve(l,p))
# c=-1
# for i in range(len(ar)-1):
# 	if ar[i][1]==ar[i+1][1]:
# 		c=i
# 	else:
# 		m = ar[c:i+1]
# 		m=sorted(m,key=pack)
# 		ar[c:i+1]=m


import collections
import math
# 011011
#
def sort(key):
	return key[1]
def pack(key):
	return key[0]

def gcd(a,b):
	if b ==0 :
		return a
	else:
		return gcd(b,a%b)
def solve(l,p):
	if l<=1:
		return p
	if p[0] == p[len(p)-1]:
		return p[0]*l
	if p[0] != p[len(p)-1] and len(p)>2:
		return p[0]+ ('0'*(l-2)) +p[l-1]
	return p[0]+p[len(p)-1]
k = int(input())
for i in range(k):
	l = int(input())
	p = input()
	print(solve(l,p))
# c=-1
# for i in range(len(ar)-1):
# 	if ar[i][1]==ar[i+1][1]:
# 		c=i
# 	else:
# 		m = ar[c:i+1]
# 		m=sorted(m,key=pack)
# 		ar[c:i+1]=m


tests = int(input())
w = ""
st = ""
for i in range(tests):
    n, s = int(input()), input()

    if len(s) == 1:
        print(s)

    for j in range(1, s//2-1):
        st += s[j]
    if "1" in st:
        print("1" * n)
    else:
        print("0"*n)


tests = int(input())
w = ""
st = ""
for i in range(tests):
    n, s = int(input()), input()

    if len(s) == 1:

        print(s)
        st = ""

    for j in range(1, n*2-1):
        st += s[j]

    lst = st[0:len(st)//2]
    rst = st[len(st)//2:]

    if ("1" in lst) and ("1" in rst):
        print("1" * n)
        st = ""
    else:
        print("0"*n)
        st = ""


tests = int(input())
w = ""

while (tests > 0):
    n, s = int(input()), input()
    for i in range(0, len(s), 2):
        w += s[i]

    print(w)
    w = ""
    tests -= 1


tests = int(input())
w = ""
st = ""
for i in range(tests):
    n, s = int(input()), input()

    if len(s) == 1:
        print(s)
        st = ""

    for j in range(1, 2*n-1):
        st += s[j]

        lst, rst = st[:len(s)/2], st[len(s)/2:]

    if "1" in lst and "1" in rst:
        print("1" * n)
        st = ""
    else:
        print("0"*n)
        st = ""


for _ in range(int(input())):
    n = int(input())
    s = input()
    print('0' * (n-1) + s[n-1])


for _ in range(int(input())):
    n = int(input())
    s = input()
    print('0' * (n-1) + s[n])


for _ in range(int(input())):
    n = int(input())
    s = input()
    ans = ''
    for i in range(0, 2*n-1, 2): ans += s[i]
    print(ans)


for _ in range(int(input())):
    n = int(input())
    s = input()
    print(s[:n])


for i in range(int(input())):
    n = int(input())
    string1 = input()
    strm=(string1[n-1:n])
    res=(n-1)*"0"+strm
    print(res)


for i in range(int(input())):
    n = int(input())
    string1 = input()
    strm=(string1[n-1:n])
    res=strm*n
    print(res)


for i in range(int(input())):
    n = int(input())
    string1 = input()
    strm=(string1[n])
    res=strm+(n-1)*0


for i in range(int(input())):
    n=int(input())
    string1=input()
    string_f=string1[:n]
    string_l=string1[2*n-1:n-2:-1]
    string1_f1=string_f.count("1")
    string1_f0 = string_f.count("1")
    string1_l1 = string_f.count("1")
    string1_l0 = string_f.count("0")
    if(string1_f0==n):
        print("0"*n)
    elif(string1_f1==n):
        print("1"*n)
    elif (string1_l1 == n):
        print("1" * n)
    else:
        print("0" * n)


for i in range(int(input())):
    n = int(input())
    string1 = input()
    strm=(string1[n-1:n])
    res=strm+(n-1)*"0"
    print(res)


for i in range(int(input())):
    n=int(input())
    string1=input()
    string_f=string1[:n]
    string_l=string1[2*n-1:n-2:-1]
    string1_f1=string_f.count("1")
    string1_f0 = string_f.count("0")
    string1_l1 = string_f.count("1")
    string1_l0 = string_f.count("0")
    if(string1_f0==n):
        print("0"*n)
    elif(string1_f1==n):
        print("1"*n)
    elif (string1_l1 == n):
        print("1" * n)
    else:
        print("0" * n)


for _ in range(int(input())):
    n=int(input())
    a=list(input())
    print("".join(a[::2]))


for _ in range(int(input())):
    n=int(input())
    a=list(input())
    x=[0]
    if len(a)>1:
        for i in range(0,len(a),n-1):
            x.append(a[i])
        print(*x[:n])
    else:
        print(*a)


for _ in range(int(input())):
    n=int(input())
    a=list(input())
    x=['0']
    if len(a)>1:
        for i in range(0,len(a),n-1):
            x.append(a[i])
        print("".join(x[:n]))
    else:
        print(*a)


for _ in range(int(input())):
    n=int(input())
    a=list(input())
    print("".join(a[:n]))


# -*- coding: utf-8 -*-
"""
Created on Tue Oct 27 15:19:05 2020

@author: Xuan Loc
"""

def solve(s,n):
    if n==1:
        return s
    res=s[0]#one or zero
    for i in range(1,n):
        if s[i] !=s[0]:
            res+=s[i]
    for i in range(len(res),n):
        res+='1'
    return res
if __name__=='__main__':
   t=int(input())
   for i in range(t):
       n=int(input())
       s=input()
       print(solve(s,n))


# -*- coding: utf-8 -*-
"""
Created on Tue Oct 27 15:19:05 2020

@author: Xuan Loc
"""

def solve(s,n):
    if n==1:
        return s
    res=s[0]#one or zero
    for i in range(1,n+1):
        if s[i] !=s[0]:
            res+=s[i+1]
    for i in range(len(res),n):
        res+='0'
    return res
if __name__=='__main__':
   t=int(input())
   for i in range(t):
       n=int(input())
       s=input()
       print(solve(s,n))


# -*- coding: utf-8 -*-
"""
Created on Tue Oct 27 15:19:05 2020

@author: Xuan Loc
"""

if __name__=='__main__':
    t=int(input())
    for i in range(t):
        n=int(input())
        s=input()
        for i in range(0,len(s),2):
            print(s[i],end='')
        print('')


# -*- coding: utf-8 -*-
"""
Created on Tue Oct 27 15:19:05 2020

@author: Xuan Loc
"""

def solve(s,n):
    if n==1:
        return s
    res=s[0]
    for i in range(1,n):
        if s[i] != s[0]:
            res+=s[i+1]
    if len(res)==n:
        return res
    for i in range(len(res),n):
        res+='0'
    return res

    return res
if __name__=='__main__':
   t=int(input())
   for i in range(t):
       n=int(input())
       s=input()
       print(solve(s,n))


# -*- coding: utf-8 -*-
"""
Created on Tue Oct 27 15:19:05 2020

@author: Xuan Loc
"""

def solve(s,n):
    if n<=1:
        return s
    res=s[0]#one or zero
    for i in range(1,n+1):
        if s[i] !=s[0]:
            res+=s[i+1]
    for i in range(len(res),n):
        res+='0'
    return res
if __name__=='__main__':
   t=int(input())
   for i in range(t):
       n=int(input())
       s=input()
       print(solve(s,n))


# -*- coding: utf-8 -*-
"""
Created on Tue Oct 27 15:19:05 2020

@author: Xuan Loc
"""

def solve(s,n):
    if n<=1:
        return s
    res=s[0]#one or zero
    for i in range(1,n+1):
        if s[i] !=s[0]:
            res+=s[i+1]
    if len(res)==n:
        return res
    for i in range(len(res),n):
        res+='0'
    return res
if __name__=='__main__':
   t=int(input())
   for i in range(t):
       n=int(input())
       s=input()
       print(solve(s,n))


# -*- coding: utf-8 -*-
"""
Created on Tue Oct 27 15:19:05 2020

@author: Xuan Loc
"""

def solve(s,n):
    if n==1:
        return s
    res=s[0]#one or zero
    for i in range(1,n):
        if s[i] !=s[0]:
            res+=s[i+1]
    for i in range(len(res),n):
        res+='0'
    return res
if __name__=='__main__':
   t=int(input())
   for i in range(t):
       n=int(input())
       s=input()
       print(solve(s,n))


def get_inverter(n):
    max = (1<<n) - 1
    def inv(x): return max-x
    return inv
    # """invert each bit of unsigned integer x"""
    # pow2 = 1<<n
    # def inv(x):
    #     return ~(x+pow2) & ((pow2<<1)-1)
    # return inv

def controller(n, s):
    inv = get_inverter(n)
    excludes = [inv(int(s[i:i+n],base=2)) for i in range(n)]
    b = 0
    a = max_val = (1<<n)-1
    for x in excludes:
        if a > x:
            a = x
        if b < x:
            b = x
    if a > 0:
        return '0'*n
    if b < max_val:
        return '1'*n
    excludes = set(excludes)
    for x in range(1,n):
        if x not in excludes:
            return ('{:0%sb}' % n).format(x)
    return excludes

def c_in():
    try:
        import sys
        sys.stdin = open(sys.argv[0] + "/../in-a.txt")
    except:
        pass
    n_test_case = int(input())
    for i in range(n_test_case):
        n = int(input())
        s = input().rstrip()
        print(controller(n,s))

if __name__ == '__main__':
    c_in()


def get_inverter(n):
    max = (1<<n) - 1
    def inv(x): return max-x
    return inv
    # """invert each bit of unsigned integer x"""
    # pow2 = 1<<n
    # def inv(x):
    #     return ~(x+pow2) & ((pow2<<1)-1)
    # return inv

def controller(n, s):
    # inv = get_inverter(n)
    # excludes = [inv(int(s[i:i+n],base=2)) for i in range(n)]
    b = 0
    a = max_val = (1<<n)-1
    excludes = [max_val - int(s[i:i+n],base=2) for i in range(n)]
    # for x in excludes:
    #     if a > x:
    #         a = x
    #     if b < x:
    #         b = x
    # if a > 0:
    #     return '0'*n
    # if b < max_val:
    #     return '1'*n
    excludes = set(excludes)
    for x in range(0,n+1):
        if x not in excludes:
            return ('{:0%sb}' % n).format(x)
    return excludes

def c_in():
    try:
        import sys
        sys.stdin = open(sys.argv[0] + "/../in-a.txt")
    except:
        pass
    n_test_case = int(input())
    for i in range(n_test_case):
        n = int(input())
        s = input().rstrip()
        print(controller(n,s))

if __name__ == '__main__':
    c_in()


/*
->->->-> Vora Mahammadasim <-<-<-<-
*/
#include<bits/stdc++.h>
#define io std :: ios_base :: sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long
#define mod 1000000007
using namespace std;

signed main()
{
        io;
        int n;
        cin>>n;
        vector<vector<int>>a(n+1,vector<int>(n+1));
        for(int i=1;i<=n;i++) for(int j=1;j<=n;j++) cin>>a[i][j];
        for(int i=0;i<n;i++) cout<<(i+1)*(i+1)<<" ";

}


/*
->->->-> Vora Mahammadasim <-<-<-<-
*/
#include<bits/stdc++.h>
#define io std :: ios_base :: sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long
#define mod 1000000007
using namespace std;

signed main()
{
        io;
        int n;
        cin>>n;
        vector<vector<int>>a(n+1,vector<int>(n+1));
        for(int i=0;i<n;i++) for(int j=0;j<n;j++) cin>>a[i][j];
        int ref=(a[0][1]*a[0][2])/a[1][2];
        cout<<sqrt(ref)<<" ";
        for(int i=1;i<n;i++)
        {
            cout<<(long long)(a[i][0]/sqrt(ref))<<" ";
        }
}


/*
->->->-> Vora Mahammadasim <-<-<-<-
*/
#include<bits/stdc++.h>
#define io std :: ios_base :: sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long
#define mod 1000000007
using namespace std;

signed main()
{
        io;
        int n;
        cin>>n;
        vector<vector<int>>a(n+1,vector<int>(n+1));
        for(int i=0;i<n;i++) for(int j=0;j<n;j++) cin>>a[i][j];
        int ref=(a[0][1]*a[0][2])/a[1][2];
        cout<<(long long)sqrt(ref)<<" ";
        for(int i=1;i<n;i++)
        {
            cout<<(long long)(a[i][0]/sqrt(ref))<<" ";
        }
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <cstdio>
#include <stack>

using namespace std;

#define int long long

int t[1013][1013], n;

signed main() {
    cin >> n;
    vector<int> ans;
    for (int i = 0; i < n; i++) {
        int cur = 0;
        for (int j = 0; j < n; j++) {
            cin >> t[i][j];
            cur = __gcd(cur, t[i][j]);
        }
        ans.push_back(cur);
    }
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            if (i == j) continue;
            if (ans[i] * ans[j] != t[i][j] && ans[i] * ans[j] != 0 && t[i][j] != 0) {
                ans[i] /= ((ans[i] * ans[j]) / t[i][j]);
            }
        }
    }
    for (int elem: ans) {
        cout << elem << " ";
    }
    return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <cstdio>
#include <stack>
#include <cmath>

using namespace std;

#define int long long

int t[2013][2013], n;

signed main() {
    cin >> n;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            cin >> t[i][j];
        }
    }
    vector<int> ans (n, -1);
    for (int j = 0; j < n; j++) {
        for (int i = j + 1; i < n - 1; i++) {
            int big = t[j][i] * t[j][i + 1];
            int cur = (int) sqrt(big / t[i][i + 1]);
            ans[j] = cur;
        }
        for (int i = j - 1; i > 0; i--) {
            int big = t[j][i] * t[j][i - 1];
            int cur = (int) sqrt(big / t[i][i - 1]);
            ans[j] = cur;
        }
    }
    for (int elem: ans) {
        cout << elem << ' ';
    }
    return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <cstdio>
#include <stack>

using namespace std;

#define int long long

int t[1013][1013], n;

signed main() {
    cin >> n;
    vector<int> ans;
    for (int i = 0; i < n; i++) {
        int cur = 0;
        for (int j = 0; j < n; j++) {
            cin >> t[i][j];
            cur = __gcd(cur, t[i][j]);
        }
        if (cur == 0) {
            cur = 1;
        }
        ans.push_back(cur);
    }
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            if (i == j) continue;
            if (ans[i] * ans[j] != t[i][j] && ans[i] * ans[j] != 0) {
                ans[i] /= ((ans[i] * ans[j]) / t[i][j]);
            }
        }
    }
    for (int elem: ans) {
        cout << elem << " ";
    }
    return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <cstdio>
#include <stack>

using namespace std;

int t[1001][1001], n;

int main() {
    cin >> n;
    for (int i = 0; i < n; i++) {
        int cur = 0;
        for (int j = 0; j < n; j++) {
            cin >> t[i][j];
            cur = __gcd(cur, t[i][j]);
        }
        cout << cur << ' ';
    }
    return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <cstdio>
#include <stack>

using namespace std;

int t[1001][1001], n;

int main() {
    cin >> n;
    vector<int> ans;
    for (int i = 0; i < n; i++) {
        int cur = 0;
        for (int j = 0; j < n; j++) {
            cin >> t[i][j];
            cur = __gcd(cur, t[i][j]);
        }
        ans.push_back(cur);
    }
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            if (i == j) continue;
            if (ans[i] * ans[j] != t[i][j]) {
                ans[i] /= ((ans[i] * ans[j]) / t[i][j]);
            }
        }
    }
    for (int elem: ans) {
        cout << elem << " ";
    }
    return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <cstdio>
#include <stack>
#include <cmath>

using namespace std;

#define int long long

int t[2013][2013], n;

signed main() {
    cin >> n;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            cin >> t[i][j];
        }
    }
    vector<int> ans (n, -1);
    for (int j = 0; j < n; j++) {
        for (int i = j + 1; i < n - 1; i++) {
            int big = t[j][i] * t[j][i + 1];
            int cur = (int) sqrt(big / t[i][i + 1]);
            ans[j] = cur;
        }
        for (int i = j - 1; i > 0; i--) {
            int big = t[j][i] * t[j][i - 1];
            int cur = (int) sqrt(big / t[i][i - 1]);
            ans[j] = cur;
        }
    }
    if (n == 3) {
        int big = t[1][2] * t[1][0];
        int cur = (int) sqrt(big / t[2][0]);
        ans[1] = cur;
    }
    for (int elem: ans) {
        cout << elem << ' ';
    }
    return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <cstdio>
#include <stack>

using namespace std;

#define int long long

int t[2013][2013], n;

signed main() {
    cin >> n;
    vector<int> ans;
    for (int i = 0; i < n; i++) {
        int cur = 0;
        for (int j = 0; j < n; j++) {
            cin >> t[i][j];
            cur = __gcd(cur, t[i][j]);
        }
        ans.push_back(cur);
    }
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            if (i == j) continue;
            if (__gcd(ans[i], ans[j]) != 1) {
                ans[i] /= __gcd(ans[i], ans[j]);
                ans[j] /= __gcd(ans[i], ans[j]);
            }
        }
    }
    for (int elem: ans) {
        cout << elem << " ";
    }
    return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <cstdio>
#include <stack>

using namespace std;

#define int long long

int t[1013][1013], n;

signed main() {
    cin >> n;
    vector<int> ans;
    for (int i = 0; i < n; i++) {
        int cur = 0;
        for (int j = 0; j < n; j++) {
            cin >> t[i][j];
            cur = __gcd(cur, t[i][j]);
        }
        ans.push_back(cur);
    }
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            if (i == j) continue;
            if (ans[i] * ans[j] != t[i][j]) {
                ans[i] /= ((ans[i] * ans[j]) / t[i][j]);
            }
        }
    }
    for (int elem: ans) {
        cout << elem << " ";
    }
    return 0;
}


//LETS DO THIS
//Motiv and all other stuff

#include <bits/stdc++.h>
#define rep(i, a, b) for (long long i = a; i < b; i++)
#define rep22(i, a, b) for (long long i = a; i < b; i+=3)
#define rep2(i, a, b) for (long long i = a; i >= b; i--)
using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n;
    cin >> n;
    vector < vector<long long> > v(n, vector<long long>(n));
    rep(i,0,n){
        rep(j,0,n){
            cin >> v[i][j];
        }
    }
    long long di = 2;
    vector <long long> ans(n);
    while(true){
        bool f = false;
        rep(i,2,n){
            //cout << "bruh" << endl;
            if(v[i][0]%di!=0 || v[0][i]%di!=0||((v[0][i]/di)* (v[0][i-1]/di))!=v[i][i-1]){
                f = true;
                break;
            }
        }
        if(!f){
            break;
        }
        di++;
    }
    ans[0]=di;
    rep(i,1,n){
        ans[i]= v[i][0]/di;
    }
    rep (i,0,n){
        cout << ans[i] << " ";
    }
}


//LETS DO THIS
//Motiv and all other stuff

#include <bits/stdc++.h>
#define rep(i, a, b) for (long long i = a; i < b; i++)
#define rep22(i, a, b) for (long long i = a; i < b; i+=3)
#define rep2(i, a, b) for (long long i = a; i >= b; i--)
using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n;
    cin >> n;
    vector < vector<long long> > v(n, vector<long long>(n));
    rep(i,0,n){
        rep(j,0,n){
            cin >> v[i][j];
        }
    }
    long long di = 1, ts = 1000000;
    vector <long long> ans(n);
    while(true){
        bool f = false;
        rep(i,2,n){
            //cout << "bruh" << endl;
            if(v[i][0]%di!=0 || v[0][i]%di!=0||((v[0][i]/di)* (v[0][i-1]/di))!=v[i][i-1]){
                f = true;
                break;
            }
        }
        if(!f){
            break;
        }
        di++;
    }
    bool f = false;
    rep(i,2,n){
        //cout << "bruh" << endl;
        if(v[i][0]%di!=0 || v[0][i]%di!=0||((v[0][i]/di)* (v[0][i-1]/di))!=v[i][i-1]){
            f = true;
            break;
        }
    }
    if(f){
        di=1000000000;
        bool f = false;
        rep(i,2,n){
        //cout << "bruh" << endl;
            if(v[i][0]%di!=0 || v[0][i]%di!=0||((v[0][i]/di)* (v[0][i-1]/di))!=v[i][i-1]){
                f = true;
                break;
            }
        }
    }
    ans[0]=di;
    rep(i,1,n){
        ans[i]= v[i][0]/di;
    }
    rep (i,0,n){
        cout << ans[i] << " ";
    }
}


//LETS DO THIS
//Motiv and all other stuff

#include <bits/stdc++.h>
#define rep(i, a, b) for (long long i = a; i < b; i++)
#define rep22(i, a, b) for (long long i = a; i < b; i+=3)
#define rep2(i, a, b) for (long long i = a; i >= b; i--)
using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n;
    cin >> n;
    vector < vector<long long> > v(n, vector<long long>(n));
    rep(i,0,n){
        rep(j,0,n){
            cin >> v[i][j];
        }
    }
    long long di = 1;
    cout << 1 << " ";
    rep(i,1,n){
        cout << v[i][0] << " ";
    }
}


//LETS DO THIS
//Motiv and all other stuff

#include <bits/stdc++.h>
#define rep(i, a, b) for (long long i = a; i < b; i++)
#define rep22(i, a, b) for (long long i = a; i < b; i+=3)
#define rep2(i, a, b) for (long long i = a; i >= b; i--)
using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n;
    cin >> n;
    vector < vector<long long> > v(n, vector<long long>(n));
    rep(i,0,n){
        rep(j,0,n){
            cin >> v[i][j];
        }
    }
    long long di = 1;
    vector <long long> ans(n);
    while(true){
        bool f = false;
        rep(i,2,n){
            //cout << "bruh" << endl;
            if(v[i][0]%di!=0 || v[0][i]%di!=0||((v[0][i]/di)* (v[0][i-1]/di))!=v[i][i-1]){
                f = true;
                break;
            }
        }
        if(!f){
            break;
        }
        di++;
    }
    ans[0]=di;
    rep(i,1,n){
        ans[i]= v[i][0]/di;
    }
    rep (i,0,n){
        cout << ans[i] << " ";
    }
}


//LETS DO THIS
//Motiv and all other stuff

#include <bits/stdc++.h>
#define rep(i, a, b) for (long long i = a; i < b; i++)
#define rep22(i, a, b) for (long long i = a; i < b; i+=3)
#define rep2(i, a, b) for (long long i = a; i >= b; i--)
using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n;
    cin >> n;
    vector < vector<long long> > v(n, vector<long long>(n));
    rep(i,0,n){
        rep(j,0,n){
            cin >> v[i][j];
        }
    }
    long long di = 1, ts = 1000000;
    vector <long long> ans(n);
    while(ts--){
        bool f = false;
        rep(i,2,n){
            //cout << "bruh" << endl;
            if(v[i][0]%di!=0 || v[0][i]%di!=0||((v[0][i]/di)* (v[0][i-1]/di))!=v[i][i-1]){
                f = true;
                break;
            }
        }
        if(!f){
            break;
        }
        di++;
    }
    bool f = false;
    rep(i,2,n){
        //cout << "bruh" << endl;
        if(v[i][0]%di!=0 || v[0][i]%di!=0||((v[0][i]/di)* (v[0][i-1]/di))!=v[i][i-1]){
            f = true;
            break;
        }
    }
    if(f){
        di=1000000000;
        bool f = false;
        rep(i,2,n){
        //cout << "bruh" << endl;
            if(v[i][0]%di!=0 || v[0][i]%di!=0||((v[0][i]/di)* (v[0][i-1]/di))!=v[i][i-1]){
                f = true;
                break;
            }
        }
    }
    ans[0]=di;
    rep(i,1,n){
        ans[i]= v[i][0]/di;
    }
    rep (i,0,n){
        cout << ans[i] << " ";
    }
}


//LETS DO THIS
//Motiv and all other stuff

#include <bits/stdc++.h>
#define rep(i, a, b) for (long long i = a; i < b; i++)
#define rep22(i, a, b) for (long long i = a; i < b; i+=3)
#define rep2(i, a, b) for (long long i = a; i >= b; i--)
using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n;
    cin >> n;
    vector < vector<long long> > v(n, vector<long long>(n));
    rep(i,0,n){
        rep(j,0,n){
            cin >> v[i][j];
        }
    }
    long long di = 2;
    vector <long long> ans(n);
    while(true){
        bool f = false;
        rep(i,0,n){
            if(v[i][0]%di!=0 || v[0][i]%di!=0){
                f = true;
                break;
            }
        }
        if(!f){
            break;
        }
        di++;
    }
    ans[0]=di;
    rep(i,1,n){
        ans[i]= v[i][0]/di;
    }
    rep (i,0,n){
        cout << ans[i] << endl;
    }
}


//LETS DO THIS
//Motiv and all other stuff

#include <bits/stdc++.h>
#define rep(i, a, b) for (long long i = a; i < b; i++)
#define rep22(i, a, b) for (long long i = a; i < b; i+=3)
#define rep2(i, a, b) for (long long i = a; i >= b; i--)
using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n;
    cin >> n;
    vector < vector<long long> > v(n, vector<long long>(n));
    rep(i,0,n){
        rep(j,0,n){
            cin >> v[i][j];
        }
    }
    long long di = 1, ts = 1000000;
    vector <long long> ans(n);
    while(ts--){
        bool f = false;
        rep(i,2,n){
            //cout << "bruh" << endl;
            if(v[i][0]%di!=0 || v[0][i]%di!=0||((v[0][i]/di)* (v[0][i-1]/di))!=v[i][i-1]){
                f = true;
                break;
            }
        }
        if(!f){
            break;
        }
        di++;
    }
    bool f = false;
    rep(i,2,n){
        //cout << "bruh" << endl;
        if(v[i][0]%di!=0 || v[0][i]%di!=0||((v[0][i]/di)* (v[0][i-1]/di))!=v[i][i-1]){
            f = true;
            break;
        }
    }
    if(f){
        di=100000;
        while(di<=1000000000){
        bool f = false;
        rep(i,2,n){
            //cout << "bruh" << endl;
            if(v[i][0]%di!=0 || ((v[0][i]/di)* (v[0][i-1]/di))!=v[i][i-1]){
                f = true;
                break;
            }
        }
        if(!f){
            break;
        }
        di*=10;
    }
    }
    ans[0]=di;
    rep(i,1,n){
        ans[i]= v[i][0]/di;
    }
    rep (i,0,n){
        cout << ans[i] << " ";
    }
}


#include<bits/stdc++.h>
using namespace std;

int main()
{
    int n;
    cin>>n;
    long long s[n][n];
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            cin>>s[i][j];
        }
    }
    long long ans=sqrt((long long)((s[0][1]*s[0][2])/s[1][2]));
    cout<<ans;
    for(int i=1;i<n;i++){
        cout<<" "<<s[0][i]/ans;
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;

int main()
{
    int n;
    cin>>n;
    int s[n+1][n+1];
    for(int i=1;i<=n;i++){
        for(int j=1;j<=n;j++){
            cin>>s[i][j];
        }
    }
    int ans=sqrt((long long)((s[1][2]*s[1][3])/s[2][3]));
    cout<<ans<<" ";
    for(int i=2;i<=n;i++){
        cout<<s[1][i]/ans<<" ";
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;

int main()
{
    int n;
    cin>>n;
    int s[n+1][n+1];
    for(int i=1;i<=n;i++){
        for(int j=1;j<=n;j++){
            cin>>s[i][j];
        }
    }
    int s[1][1]=(long long)((s[1][2]*s[1][3])/s[2][3]);
    for(int i=2;i<=n;i++){
        cout<<s[1][i]/sqrt(s[0][0]);
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;

int main()
{
    int n;
    cin>>n;
    int s[n][n];
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            cin>>s[i][j];
        }
    }
    int ans=sqrt((long long)((s[0][1]*s[0][2])/s[1][2]));
    cout<<ans;
    for(int i=1;i<n;i++){
        cout<<" "<<s[0][i]/ans;
    }
    return 0;
}


#include <math.h>
#include <algorithm>
#include <array>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <vector>

using namespace std;
#define ll long long
#define ld long double

int main() {
  ll n;
  cin >> n;
  vector<ld> v(n, 0);

  vector<vector<ld>> a(n, vector<ld>(n,0));

  for (ll i = 0; i < n; i++) {
    for (ll j = 0; j < n; j++) {
      cin >> a[i][j];
    }
  }

  v[0] = a[0][2] * a[0][1] / a[1][2];
  v[0] = sqrt(v[0]);
  cout << v[0] << " ";
  for (ll i = 1; i < n; i++) {
    cout << a[0][i] / v[0] << " ";
  }

  return 0;
}


#include <math.h>
#include <algorithm>
#include <array>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <vector>

using namespace std;
#define ll long long
#define ld long double

int main() {
  size_t n;
  cin >> n;
  vector<ld> v(n, 0);

  vector<vector<ld>> a(n);
  for (auto &it : a) {
    it.resize(n);
  }

  for (size_t i = 0; i < n; i++) {
    for (size_t j = 0; j < n; j++) {
      cin >> a[i][j];
    }
  }
  // a[0][1]
  // a[0][2]
  // a[1][2]
  v[1] = a[0][2] / a[0][1];
  v[1] = a[1][2] / v[1];
  v[1] = sqrt(v[1]);
  v[0] = a[0][1] / v[1];
  for (size_t i = 2; i < n; i++) {
    v[i] = a[i - 1][i] / v[i - 1];
  }

  for (size_t i = 0; i < n; i++) {
    cout << v[i] << " ";
  }
  //cout << v[1] << endl;

  return 0;
}


#include <math.h>
#include <algorithm>
#include <array>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <vector>

using namespace std;
#define ll long long
#define ld long double

int main() {
  size_t n;
  cin >> n;
  vector<ld> v(n, 0);

  vector<vector<ld>> a(n, vector<ld>(n,0));

  for (size_t i = 0; i < n; i++) {
    for (size_t j = 0; j < n; j++) {
      cin >> a[i][j];
    }
  }
  // a[0][1]
  // a[0][2]
  // a[1][2]
  v[1] = (double)a[0][2] / (double)a[0][1];
  v[1] = (double)a[1][2] / (double)v[1];
  v[1] = sqrt(v[1]);
  v[0] = (double)a[0][1] / (double)v[1];
  for (size_t i = 2; i < n; i++) {
    v[i] = (double)a[i - 1][i] / (double)v[i - 1];
  }

  for (size_t i = 0; i < n; i++) {
    cout << v[i] << " ";
  }

  return 0;
}


#include <algorithm>
#include <iostream>
#include <limits>
#include <map>
#include <math.h>
#include <numeric>
#include <set>
#include <string>
#include <vector>

using namespace std;
#define ll long long
#define ld long double

//cout << fixed << setprecision(2) // округление

//struct node{
//    int a;
//    int b;
//};

//bool operator < (const node& lhs, const node& rhs)
//{
//return lhs.a < rhs.a || lhs.a == rhs.a && lhs.b < rhs.b;
//}

//#ifndef ONLINE_JUDGE
//    cout << "\nTime elapsed: " << (1000 * clock() / CLOCKS_PER_SEC) << "ms\n";
//#endif

int main(){
    ll n;
    cin >> n;
    ld a[n][n];
    vector <ld> v(n,0);
    for (ll i = 0; i < n; i++)
    {
        for (ll j = 0; j < n; j++)
        {
            cin >> a[i][j];
        }
    }
    //a[0][1]
    //a[0][2]
    //a[1][2]
    v[1] = a[0][2] / a[0][1];
    v[1] = sqrt(a[1][2] / v[1]);
    v[0] = a[0][1] / v[1];
    for (ll i = 2; i < n; i++)
    {
        v[i] = a[i-1][i] / v[i-1];
    }

    for (ll i = 0; i < n; i++)
    {
        cout << v[i] << " ";
    }

    return 0;
}


#include <math.h>
#include <algorithm>
#include <array>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <vector>

using namespace std;
#define ll long long
#define ld long double

int main() {
  size_t n;
  cin >> n;
  vector<ld> v(n, 0);

  vector<vector<ld>> a(n, vector<ld>(n,0));

  for (size_t i = 0; i < n; i++) {
    for (size_t j = 0; j < n; j++) {
      cin >> a[i][j];
    }
  }
  // a[0][1]
  // a[0][2]
  // a[1][2]
  v[0] = a[0][2] * a[0][1] / a[1][2];
  v[0] = sqrt(v[0]);
  cout << v[0] << " ";
  for (size_t i = 1; i < n; i++) {
    cout << a[0][i] / v[0] << " ";
  }

  return 0;
}


#include <math.h>
#include <algorithm>
#include <array>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <vector>

using namespace std;
#define ll long long
#define ld long double

int main() {
  size_t n;
  cin >> n;
  vector<ld> v(n, 0);

  vector<vector<ld>> a(n, vector<ld>(n,0));

  for (size_t i = 0; i < n; i++) {
    for (size_t j = 0; j < n; j++) {
      cin >> a[i][j];
    }
  }
  // a[0][1]
  // a[0][2]
  // a[1][2]
  v[0] = a[1][2] * a[0][2] / a[0][1];
  v[0] = sqrt(v[0]);
  cout << v[0] << " ";
  for (size_t i = 1; i < n; i++) {
    cout << a[0][i] / v[0] << " ";
  }

  return 0;
}


#include <math.h>
#include <algorithm>
#include <array>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <vector>

using namespace std;
#define ll long long
#define ld long double

int main() {
  size_t n;
  cin >> n;
  vector<ld> v(n, 0);

  vector<vector<ld>> a(n, vector<ld>(n,0));

  for (size_t i = 0; i < n; i++) {
    for (size_t j = 0; j < n; j++) {
      cin >> a[i][j];
    }
  }
  // a[0][1]
  // a[0][2]
  // a[1][2]
  v[1] = a[1][2] * a[0][1] / a[0][2];
  v[1] = sqrt(v[1]);
  v[0] = a[0][1] / v[1];
  cout << v[0] << " " << v[1] << " ";
  for (size_t i = 2; i < n; i++) {
    cout << (double)a[0][i] / (double)v[0] << " ";
  }

  return 0;
}


#include <math.h>
#include <algorithm>
#include <array>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <vector>

using namespace std;
#define ll long long
#define ld long double

int main() {
  ll n;
  cin >> n;
  vector<ld> v(n, 0);

  vector<vector<ld>> a(n, vector<ld>(n,0));

  for (ll i = 0; i < n; i++) {
    for (ll j = 0; j < n; j++) {
      cin >> a[i][j];
    }
  }

  v[0] = sqrt(a[0][2] * a[0][1] / a[1][2]);
  cout << v[0] << " ";
  for (ll i = 1; i < n; i++) {
    cout << a[0][i] / v[0] << " ";
  }

  return 0;
}


#include <math.h>
#include <algorithm>
#include <array>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <vector>

using namespace std;
#define ll long long
#define ld long double

int main() {
  size_t n;
  cin >> n;
  vector<ld> v(n, 0);

  vector<vector<ld>> a(n, vector<ld>(n,0));

  for (size_t i = 0; i < n; i++) {
    for (size_t j = 0; j < n; j++) {
      cin >> a[i][j];
    }
  }
  // a[0][1]
  // a[0][2]
  // a[1][2]
  v[0] = a[1][2] * a[0][1] / a[0][2];
  v[0] = sqrt(v[0]);
  cout << v[0] << " ";
  for (size_t i = 1; i < n; i++) {
    cout << a[0][i] / v[0] << " ";
  }

  return 0;
}


#include <math.h>
#include <algorithm>
#include <array>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <vector>

using namespace std;
#define ll long long
#define ld long double

int main() {
  ll n;
  cin >> n;
  vector<ll> v(n, 0);

  vector<vector<ll>> a(n, vector<ll>(n,0));

  for (ll i = 0; i < n; i++) {
    for (ll j = 0; j < n; j++) {
      cin >> a[i][j];
    }
  }

  v[0] = sqrt(a[0][2] * a[0][1] / a[1][2]);
  cout << v[0] << " ";
  for (ll i = 1; i < n; i++) {
    cout << a[0][i] / v[0] << " ";
  }

  return 0;
}


#include <math.h>
#include <algorithm>
#include <array>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <vector>

using namespace std;
#define ll long long
#define ld long double

int main() {
  size_t n;
  cin >> n;
  vector<ld> v(n, 0);

  vector<vector<ld>> a(n);
  for (auto &it : a) {
    it.resize(n);
  }

  for (size_t i = 0; i < n; i++) {
    for (size_t j = 0; j < n; j++) {
      cin >> a[i][j];
    }
  }
  // a[0][1]
  // a[0][2]
  // a[1][2]
  v[1] = (double)a[0][2] / (double)a[0][1];
  v[1] = (double)a[1][2] / (double)v[1];
  v[1] = sqrt(v[1]);
  v[0] = (double)a[0][1] / (double)v[1];
  for (size_t i = 2; i < n; i++) {
    v[i] = (double)a[i - 1][i] / (double)v[i - 1];
  }

  for (size_t i = 0; i < n; i++) {
    cout << v[i] << " ";
  }

  return 0;
}


#include <math.h>
#include <algorithm>
#include <array>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <vector>

using namespace std;
#define ll long long
#define ld long double

int main() {
  size_t n;
  cin >> n;
  vector<ld> v(n, 0);

  vector<vector<ld>> a(n, vector<ld>(n,0));

  for (size_t i = 0; i < n; i++) {
    for (size_t j = 0; j < n; j++) {
      cin >> a[i][j];
    }
  }
  // a[0][1]
  // a[0][2]
  // a[1][2]
  v[0] = a[1][2] * a[0][2] / a[0][1];
  v[0] = sqrt(v[0]);
  cout << v[0] << " " << v[1] << " ";
  for (size_t i = 1; i < n; i++) {
    cout << (double)a[0][i] / (double)v[0] << " ";
  }

  return 0;
}


#include <math.h>
#include <algorithm>
#include <array>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <vector>

using namespace std;
#define ll long long
#define ld long double

int main() {
  size_t n;
  cin >> n;
  vector<ld> v(n, 0);

  vector<vector<ld>> a(n, vector<ld>(n,0));

  for (size_t i = 0; i < n; i++) {
    for (size_t j = 0; j < n; j++) {
      cin >> a[i][j];
    }
  }
  // a[0][1]
  // a[0][2]
  // a[1][2]
  v[1] = (double)a[0][2] / (double)a[0][1];
  v[1] = (double)a[1][2] / (double)v[1];
  v[1] = sqrt(v[1]);
  v[0] = (double)a[0][1] / (double)v[1];
  cout << v[0] << " " << v[1] << " ";
  for (size_t i = 2; i < n; i++) {
    cout << (double)a[0][i] / (double)v[0] << " ";
  }

  return 0;
}


#include <math.h>
#include <algorithm>
#include <array>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <vector>

using namespace std;
#define ll long long
#define ld long double

int main() {
  size_t n;
  cin >> n;
  vector<ld> v(n, 0);

  vector<vector<ld>> a(n);
  for (auto &it : a) {
    it.resize(n);
  }

  for (size_t i = 0; i < n; i++) {
    for (size_t j = 0; j < n; j++) {
      cin >> a[i][j];
    }
  }
  // a[0][1]
  // a[0][2]
  // a[1][2]
  v[1] = a[0][2] / a[0][1];
  v[1] = sqrt(a[1][2] / v[1]);
  v[0] = a[0][1] / v[1];
  for (size_t i = 2; i < n; i++) {
    v[i] = a[i - 1][i] / v[i - 1];
  }

  for (size_t i = 0; i < n; i++) {
    cout << v[i] << " ";
  }

  return 0;
}


#include<bits/stdc++.h>

using namespace std;
typedef long long ll;

int main()
{
    int n;
    cin >> n;

    vector<long double> v(n);
    long double a;
    cin >> a;
    for (int i = 1; i < n; i++) {
        cin >> v[i-1];
    }
    cin >> a >> a >> v[n-1];

    for (int i = 3; i < n; i++) {
        cin >> a;
    }

    for (int i = 2; i < n; i++) {
        for (int j = 0; j < n; j++)
            cin >> a;
    }

    ll ans;

    ans = (ll)sqrt((v[0]*v[1])/v[n-1]);
    cout << ans << ' ';
    for (int i = 0; i < n-1; i++) {
        cout << (ll) (v[i]/ans) << ' ';
    }

    return 0;
}


#include<bits/stdc++.h>

using namespace std;
typedef long long ll;

int main()
{
    int n;
    cin >> n;

    vector<long double> v;
    long double a[n][n];
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            cin >> a[i][j];
            if (i==0&&j>0) v.push_back(a[i][j]);
            if (i==1&&j==2) v.push_back(a[i][j]);
        }
    }

    ll ans[n];

    ans[0] = (ll)sqrt(((v[0]/v[n-1])*v[1]));
    for (int i = 0; i < n*1; i++) {
        ans[i+1] = (ll) (v[i]/ans[0]);
    }

    for (int i = 0; i < n; i++)
        cout << ans[i] << ' ';

    return 0;
}


#include<bits/stdc++.h>

using namespace std;
typedef long long ll;

int main()
{
    int n;
    cin >> n;

    long double v[n];
    long double a;
    cin >> a;
    for (int i = 1; i < n; i++) {
        cin >> v[i-1];
    }
    cin >> a >> a >> v[n-1];

    for (int i = 3; i < n; i++) {
        cin >> a;
    }

    for (int i = 2; i < n; i++) {
        for (int j = 0; j < n; j++)
            cin >> a;
    }

    ll ans;

    ans = (ll)sqrt((v[0]*v[1])/v[n-1]);
    cout << ans << ' ';
    for (int i = 0; i < n-1; i++) {
        cout << (ll) (v[i]/ans) << ' ';
    }

    return 0;
}


#include<bits/stdc++.h>

using namespace std;
typedef long long ll;

int main()
{
    int n;
    cin >> n;

    vector<long double> v;
    long double a[n][n];
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            cin >> a[i][j];
            if (i==0&&j>0) v.push_back(a[i][j]);
            if (i==1&&j==2) v.push_back(a[i][j]);
        }
    }

    ll ans[n];

    ans[0] = (ll)sqrt((v[0]*v[1])/v[n-1]);
    for (int i = 0; i < n-1; i++) {
        ans[i+1] = (ll) (v[i]/ans[0]);
    }

    for (int i = 0; i < n; i++)
        cout << ans[i] << ' ';

    return 0;
}


#include<bits/stdc++.h>

using namespace std;
typedef long long ll;

int main()
{
    int n;
    cin >> n;

    ll v[n];
    ll a;

    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            cin >> a;
            if (i==0 && j>0)
                v[j-1] = a;
            else if (i==1 && j==2)
                v[n-1] = a;
        }
    }

    ll ans;

    ans = sqrt((v[0]*v[1])/v[n-1]);
    cout << ans << ' ';
    for (int i = 0; i < n-1; i++) {
        cout << (v[i]/ans) << ' ';
    }

    return 0;
}


#include<bits/stdc++.h>

using namespace std;
typedef long long ll;

int main()
{
    int n;
    cin >> n;

    vector<long double> v;
    long double a[n][n];
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            cin >> a[i][j];
            if (i>1) continue;
            else if (i==0&&j>0) v.push_back(a[i][j]);
            else if (i==1&&j==2) v.push_back(a[i][j]);
        }
    }

    ll ans;

    ans = (ll)sqrt((v[0]*v[1])/v[n-1]);
    cout << ans << ' ';
    for (int i = 0; i < n-1; i++) {
        cout << (ll) (v[i]/ans) << ' ';
    }

    return 0;
}


#include <bits/stdc++.h>

using namespace std;
long long mas[1001][1001];
long long a[10000];
long long x,y;
long long n,m;
long long i,j;
long long l;
long long k;
int p;

int main()
{
cin >> n;

for(i=0;i<n;i++)
{
    for(j=0;j<n;j++)
        cin >> mas[i][j];

}
l=mas[0][1];
for(j=2;j<n;j++)

x=mas[1][0];

for(k=1;k*k<=x+10;k++)
{

l=k;

    if(x%l>0)
        continue;
    p=1;

    for(i=1;i<n;i++)
    {
        if(mas[0][i]%l>0)
        {
            p=0;
            break;

        }
        a[i]=mas[0][i]/l;
    }
    a[0]=l;
if(p)
{

    for(i=0;i<n;i++)
    {

    if(p==0)
        break;
        for(j=0;j<n;j++)
    {
        if(i==j)
            continue;
        if(a[i]*a[j]!=mas[i][j])
        {
            p=0;
            break;

        }
    }
    }
  //cout << endl;
  if(p)
  {

        for(i=0;i<n;i++)
            cout << a[i] << ' ' ;
        return 0;
  }
}

  ////

  ////

l=x/k;
//cout << endl << ' ' << k;
    p=1;

    for(i=1;i<n;i++)
    {
        if(mas[0][i]%l>0)
        {
            p=0;
            break;

        }
        a[i]=mas[0][i]/l;
    }
    a[0]=l;
    if(p==0)
        continue;
    for(i=0;i<n;i++)
    {

    if(p==0)
        break;
        for(j=0;j<n;j++)
    {
        if(i==j)
            continue;
        if(a[i]*a[j]!=mas[i][j])
        {
            p=0;
            break;

        }
    }
    }
  //cout << endl;
  if(p)
  {

        for(i=0;i<n;i++)
            cout << a[i] << ' ' ;
        return 0;
  }
}
}


#include <bits/stdc++.h>

using namespace std;
int mas[1001][1001];
int a[10000];
int x,y;
int n,m;
int i,j;
int l;
int p;
int main()
{
cin >> n;
for(i=0;i<n;i++)
{
    for(j=0;j<n;j++)
        cin >> mas[i][j];
}
x=mas[1][0];
for(l=1;l<=x;l++)
{
    if(x%l>0)
        continue;
    p=1;

    for(i=1;i<n;i++)
    {
        if(mas[0][i]%l>0)
        {
            p=0;
            break;

        }
        a[i]=mas[0][i]/l;
    }
    a[0]=l;
    if(p==0)
        continue;
    for(i=0;i<n;i++)
    {

    if(p==0)
        break;
        for(j=0;j<n;j++)
    {
        if(i==j)
            continue;
        if(a[i]*a[j]!=mas[i][j])
        {
            p=0;
            break;

        }
    }
    }
  //cout << endl;
  if(p)
  {

        for(i=0;i<n;i++)
            cout << a[i] << ' ' ;
        return 0;
  }
}
}


#include <bits/stdc++.h>

using namespace std;
int mas[1001][1001];
int a[10000];
int x,y;
int n,m;
int i,j;
int l;
int p;
int main()
{
cin >> n;
for(i=0;i<n;i++)
{
    for(j=0;j<n;j++)
        cin >> mas[i][j];
}
x=mas[1][0];
for(l=1;l<=x;l++)
{
    if(l*l>x+10)
        l=x;
    if(x%l>0)
        continue;
    p=1;

    for(i=1;i<n;i++)
    {
        if(mas[0][i]%l>0)
        {
            p=0;
            break;

        }
        a[i]=mas[0][i]/l;
    }
    a[0]=l;
    if(p==0)
        continue;
    for(i=0;i<n;i++)
    {

    if(p==0)
        break;
        for(j=0;j<n;j++)
    {
        if(i==j)
            continue;
        if(a[i]*a[j]!=mas[i][j])
        {
            p=0;
            break;

        }
    }
    }
  //cout << endl;
  if(p)
  {

        for(i=0;i<n;i++)
            cout << a[i] << ' ' ;
        return 0;
  }
}
}


#include <bits/stdc++.h>

using namespace std;
int mas[1001][1001];
int a[10000];
int x,y;
int n,m;
int i,j;
int l;
int p;
int main()
{
cin >> n;
for(i=0;i<n;i++)
{
    for(j=0;j<n;j++)
        cin >> mas[i][j];
}
x=mas[1][0];
for(l=1;l<=x;l++)
{
   // if(l*l>x+10)
     //   l=x-1;
    if(x%l>0)
        continue;
    p=1;

    for(i=1;i<n;i++)
    {
        if(mas[0][i]%l>0)
        {
            p=0;
            break;

        }
        a[i]=mas[0][i]/l;
    }
    a[0]=l;
    if(p==0)
        continue;
    for(i=0;i<n;i++)
    {

    if(p==0)
        break;
        for(j=0;j<n;j++)
    {
        if(i==j)
            continue;
        if(a[i]*a[j]!=mas[i][j])
        {
            p=0;
            break;

        }
    }
    }
  //cout << endl;
  if(p)
  {

        for(i=0;i<n;i++)
            cout << a[i] << ' ' ;
        return 0;
  }
}
}


#include <bits/stdc++.h>

using namespace std;
int mas[1001][1001];
int a[10000];
int x,y;
int n,m;
int i,j;
int l;
int p;
int main()
{
cin >> n;
for(i=0;i<n;i++)
{
    for(j=0;j<n;j++)
        cin >> mas[i][j];
}
x=mas[1][0];
for(l=1;l<=x;l++)
{
    if(l*l>x+1)
        l=x;
    if(x%l>0)
        continue;
    p=1;

    for(i=1;i<n;i++)
    {
        if(mas[0][i]%l>0)
        {
            p=0;
            break;

        }
        a[i]=mas[0][i]/l;
    }
    a[0]=l;
    if(p==0)
        continue;
    for(i=0;i<n;i++)
    {

    if(p==0)
        break;
        for(j=0;j<n;j++)
    {
        if(i==j)
            continue;
        if(a[i]*a[j]!=mas[i][j])
        {
            p=0;
            break;

        }
    }
    }
  //cout << endl;
  if(p)
  {

        for(i=0;i<n;i++)
            cout << a[i] << ' ' ;
        return 0;
  }
}
}


#include <bits/stdc++.h>

using namespace std;
int mas[1001][1001];
int a[10000];
int x,y;
int n,m;
int i,j;
int l;
int p;
int nod(int c,int d)
{
    if(c%d==0)
        return d;
    if(d%c==0)
        return c;
            if(c>d)
        return nod(c%d,d);
        else
     return nod(c,d%c);
}
int main()
{
cin >> n;

for(i=0;i<n;i++)
{
    for(j=0;j<n;j++)
        cin >> mas[i][j];

}
l=mas[0][1];
for(j=2;j<n;j++)
    l=nod(l,mas[0][j]);
x=mas[1][0];

for(l;l<=x;l++)
{

    if(x%l>0)
        continue;
    p=1;

    for(i=1;i<n;i++)
    {
        if(mas[0][i]%l>0)
        {
            p=0;
            break;

        }
        a[i]=mas[0][i]/l;
    }
    a[0]=l;
    if(p==0)
        continue;
    for(i=0;i<n;i++)
    {

    if(p==0)
        break;
        for(j=0;j<n;j++)
    {
        if(i==j)
            continue;
        if(a[i]*a[j]!=mas[i][j])
        {
            p=0;
            break;

        }
    }
    }
  //cout << endl;
  if(p)
  {

        for(i=0;i<n;i++)
            cout << a[i] << ' ' ;
        return 0;
  }
}
}


#include <bits/stdc++.h>

using namespace std;
int mas[10000][10000];
int a[10000];
int x,y;
int n,m;
int i,j;
int l;
int p;
int main()
{
cin >> n;
for(i=0;i<n;i++)
{
    for(j=0;j<n;j++)
        cin >> mas[i][j];
}
x=mas[1][0];
for(l=1;l<=x;l++)
{
    if(x%l>0)
        continue;
    p=1;

    for(i=1;i<n;i++)
    {
        if(mas[0][i]%l>0)
        {
            p=0;
            break;

        }
        a[i]=mas[0][i]/l;
    }
    a[0]=l;
    if(p==0)
        continue;
    for(i=0;i<n;i++)
    {

    if(p==0)
        break;
        for(j=0;j<n;j++)
    {
        if(i==j)
            continue;
        if(a[i]*a[j]!=mas[i][j])
        {
            p=0;
            break;

        }
    }
    }
  //cout << endl;
  if(p)
  {

        for(i=0;i<n;i++)
            cout << a[i] << ' ' ;
        return 0;
  }
}
}


#include <bits/stdc++.h>

using namespace std;
int mas[1001][1001];
int a[10000];
int x,y;
int n,m;
int i,j;
int l;
int p;
int main()
{
cin >> n;
for(i=0;i<n;i++)
{
    for(j=0;j<n;j++)
        cin >> mas[i][j];
}
x=mas[1][0];
for(l=1;l<=x;l++)
{
    if(l*l>x+10)
        l=x-1;
    if(x%l>0)
        continue;
    p=1;

    for(i=1;i<n;i++)
    {
        if(mas[0][i]%l>0)
        {
            p=0;
            break;

        }
        a[i]=mas[0][i]/l;
    }
    a[0]=l;
    if(p==0)
        continue;
    for(i=0;i<n;i++)
    {

    if(p==0)
        break;
        for(j=0;j<n;j++)
    {
        if(i==j)
            continue;
        if(a[i]*a[j]!=mas[i][j])
        {
            p=0;
            break;

        }
    }
    }
  //cout << endl;
  if(p)
  {

        for(i=0;i<n;i++)
            cout << a[i] << ' ' ;
        return 0;
  }
}
}


#include<bits/stdc++.h>
using namespace std;

#define ll long long
#define v vector
#define ld long double

int main()
{
    int n,i,j;
    cin>>n;
    v<v<ll>> a(n,v<ll> (n,0));
    v<int> ans;
    for( i = 0 ;  i < n ; i++)
    {
        for( j = 0 ; j < n ; j++)
        cin>>a[i][j];
    }
    if(n == 2)
    {
        cout<<1<<" "<<a[0][1];
    }
    ld x = a[1][0]*a[2][0];
    x = floor(x/a[1][2]);
    ll temp = sqrt(x);
    ans.push_back(temp);
    for(i = 1 ; i < n ; i++)
    {
        ans.push_back(a[0][i]/temp);
    }
    for( i = 0 ; i < n ; i++)
    {
        cout<<ans[i]<<" ";
    }
    return 0;
}


#include<bits/stdc++.h>
using namespcace std;

#define ll long long
#define v vector

int main()
{
    int n,i,j;
    cin>>n;
    v<v<ll>> a(n,v<ll>> (n,0));
    v<int> ans;
    for( i = 0 ;  i < n ; i++)
    {
        for( j = 0 ; j < n ; j++)
        cin>>a[i][j];
    }
    if(n == 2)
    {
        cout<<1<<" "<<a[0][1];
    }
    int temp = sqrt((a[1][0]*a[2][1])/a[2][0]);
    ans.push_back(sqrt((a[1][0]*a[2][1])/a[2][0]));
    for(i = 1 ; i < n ; i++)
    {
        ans.push_back(a[0][i]/temp);
    }
    for( i = 0 ; i < n ; i++)
    {
        cout<<ans[i]<<" ";
    }
    return 0;
}


#include<bits/stdc++.h>
using namespcace std;

#define ll long long
#define v vector

int main()
{
    int n,i,j;
    cin>>n;
    v<v<ll>> a(n,v<ll> (n,0));
    v<int> ans;
    for( i = 0 ;  i < n ; i++)
    {
        for( j = 0 ; j < n ; j++)
        cin>>a[i][j];
    }
    if(n == 2)
    {
        cout<<1<<" "<<a[0][1];
    }
    int temp = sqrt((a[1][0]*a[2][1])/a[2][0]);
    ans.push_back(sqrt((a[1][0]*a[2][1])/a[2][0]));
    for(i = 1 ; i < n ; i++)
    {
        ans.push_back(a[0][i]/temp);
    }
    for( i = 0 ; i < n ; i++)
    {
        cout<<ans[i]<<" ";
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;

#define ll long long
#define v vector

int main()
{
    int n,i,j;
    cin>>n;
    v<v<ll>> a(n,v<ll> (n,0));
    v<int> ans;
    for( i = 0 ;  i < n ; i++)
    {
        for( j = 0 ; j < n ; j++)
        cin>>a[i][j];
    }
    if(n == 2)
    {
        cout<<1<<" "<<a[0][1];
    }
    int temp = sqrt((a[1][0]*a[2][1])/a[2][0]);
    ans.push_back(sqrt((a[1][0]*a[2][1])/a[2][0]));
    for(i = 1 ; i < n ; i++)
    {
        ans.push_back(a[0][i]/temp);
    }
    for( i = 0 ; i < n ; i++)
    {
        cout<<ans[i]<<" ";
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;

#define ll long long
#define v vector

int main()
{
    int n,i,j;
    cin>>n;
    v<v<ll>> a(n,v<ll>> (n,0));
    v<int> ans;
    for( i = 0 ;  i < n ; i++)
    {
        for( j = 0 ; j < n ; j++)
        cin>>a[i][j];
    }
    if(n == 2)
    {
        cout<<1<<" "<<a[0][1];
    }
    int temp = sqrt((a[1][0]*a[2][1])/a[2][0]);
    ans.push_back(sqrt((a[1][0]*a[2][1])/a[2][0]));
    for(i = 1 ; i < n ; i++)
    {
        ans.push_back(a[0][i]/temp);
    }
    for( i = 0 ; i < n ; i++)
    {
        cout<<ans[i]<<" ";
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
const long long MAX_SIZE = 1000001;
#define ll long long
#define mp make_pair

bool check(vector< vector < ll > > &b,vector< vector < ll > > &a,int x,int n)
{
	vector< vector < ll > > c (n,vector<ll> (n,0));
	for( int i = 0 ; i < n ; i++)
	{
		for(int j = 0 ; j < n ; j++)
		{
			if(i != j)
			{
				c[i][j] = b[x][i] * b[x][j];
			}
			else
			c[i][j] = 0;
		}
	}
	if(c == a)
	return true;
	return false;
}

int main()
{
	int n,i,j,k;
	cin>>n;
	vector< vector < ll > > a(n,vector<ll> (n,0));
	vector< vector < ll > > b(n,vector<ll> (n,0));
	for(i = 0; i < n ; i++ )
	{
		for( j = 0 ; j < n ; j++)
		cin>>a[i][j];
	}
	vector< ll > v(n,0);
	for( int  i = 0 ; i < n ; i++)
	{
		ll temp = 0;
		for(int j = 0 ; j < n ; j++)
		{
			temp = __gcd(temp,a[i][j]);
		}
		//v[i] = temp;
	 	b[i][i] = temp;
	 	for( k = 0 ; k < i ; k++)
	 	{
	 		b[i][k] = a[i][k]/temp;
		}
		for( k = i+1 ; k < n ; k++)
	 	{
	 		b[i][k] = a[i][k]/temp;
		}
	}
	for(i = 0 ;i < n ; i++)
	if(check(b,a,i,n))
	{
		for(int j = 0 ; j < n ; j++)
		cout<<b[i][j]<<" ";
		return 0;
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
const long long MAX_SIZE = 1000001;
#define ll long long
#define mp make_pair

int main()
{
	int n,i,j;
	cin>>n;
	vector< vector < ll > > a(n,vector<ll> (n,0));
	for(i = 0; i < n ; i++ )
	{
		for( j = 0 ; j < n ; j++)
		cin>>a[i][j];
	}
	vector< ll > v(n,0);
	for( int  i = 0 ; i < n ; i++)
	{
		ll temp = 0;
		for(int j = i+1 ; j < n ; j++)
		{
			temp = __gcd(temp,a[i][j]);
		}
		for(j = 0 ; j < i ; j++)
		temp = __gcd(temp,a[i][j]);
		v[i] = temp;
	}
	for(int i = 0 ; i < n ; i++)
	cout<<v[i]<<" ";
	return 0;
}


#include<bits/stdc++.h>
using namespace std;

#define ll long long
#define v vector
#define ld long double

int main()
{
    int n,i,j;
    cin>>n;
    v<v<ll>> a(n,v<ll> (n,0));
    v<int> ans;
    for( i = 0 ;  i < n ; i++)
    {
        for( j = 0 ; j < n ; j++)
        cin>>a[i][j];
    }
    if(n == 2)
    {
        cout<<1<<" "<<a[0][1];
    }
    ld x = a[1][0]*a[2][1];
    x = x/a[2][0];
    ll temp = sqrt(x);
    ans.push_back(temp);
    for(i = 1 ; i < n ; i++)
    {
        ans.push_back(a[0][i]/temp);
    }
    for( i = 0 ; i < n ; i++)
    {
        cout<<ans[i]<<" ";
    }
    return 0;
}


#include <iostream>
#include <cmath>
using namespace std;
int n;
long long a[1010];
int main() {
	cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
	}
	long long k;
	cin>>k;
	cin>>k;
	cin>>k;
	long long x = (long long)a[2]*a[1]/k;
	cout << x << endl;
	long double dx = x;
	long long ans=(long long)(sqrt(x)+0.005);

	cout<<ans<<' ';
	for(int i=1;i<n;i++)
	{
		cout<<a[i]/ans<<' ';
	}
	return 0;
}


#include <iostream>
#include <cmath>
using namespace std;
int n;
long long a[1010];
int main() {
	cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
	}
	long long k;
	cin>>k;
	cin>>k;
	cin>>k;
	long long ans=(sqrt(((1LL*(k))/a[2])*a[1]));

	cout<<ans<<' ';
	for(int i=1;i<n;i++)
	{
		cout<<a[i]/ans<<' ';
	}
	return 0;
}


#include <iostream>
#include <cmath>
using namespace std;
int n;
long long a[1010];
int main() {
	cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
	}
	long long k;
	cin>>k;
	cin>>k;
	cin>>k;
	long long ans=(sqrt(((1.0*(k))/(1.0*a[2]))*1.0*a[1]));

	cout<<ans<<' ';
	for(int i=1;i<n;i++)
	{
		cout<<a[i]/ans<<' ';
	}
	return 0;
}


#include <iostream>
#include <cmath>
using namespace std;
int n;
long long a[1010];
int main() {
	cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
	}
	long long k;
	cin>>k;
	cin>>k;
	cin>>k;
	long long x = (long long)a[2]*a[1]/k;
	//cout << x << endl;
	long double dx = x;
	long long ans=(long long)(sqrt(x)+0.005);

	cout<<ans<<' ';
	for(int i=1;i<n;i++)
	{
		cout<<a[i]/ans<<' ';
	}
	return 0;
}


#include <iostream>
#include <cmath>
using namespace std;
int n;
long long a[1010];
int main() {
	cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
	}
	long long k;
	cin>>k;
	cin>>k;
	cin>>k;
	long long ans=sqrt(((k)/a[2])*a[1]);
	cout<<ans<<' ';
	for(int i=1;i<n;i++)
	{
		cout<<a[i]/ans<<' ';
	}
	return 0;
}


#include <iostream>
#include <cmath>
using namespace std;
int n;
long long a[1010];
int main() {
	cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
	}
	long long k;
	cin>>k;
	cin>>k;
	cin>>k;
	long long ans=sqrt((1LL*(k)*a[1])/a[2]);
	cout<<ans<<' ';
	for(int i=1;i<n;i++)
	{
		cout<<a[i]/ans<<' ';
	}
	return 0;
}


#include <iostream>
#include <cmath>
using namespace std;
int n;
long long a[1010];
int main() {
	cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
	}
	long long k;
	cin>>k;
	cin>>k;
	cin>>k;
	long long ans=sqrt(((k)/a[2])*a[1]*1LL);
	cout<<ans<<' ';
	for(int i=1;i<n;i++)
	{
		cout<<a[i]/ans<<' ';
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define rep(i, m, n) for (int i = m; i < n; ++i)

long long gcd(long long a, long long b) {
    if (a % b == 0) return b;
    return gcd(b, a % b);
}

template<class T> void print(vector<T> &vec) {
    for(int i = 0; i < (int)vec.size(); ++i) {
        if(i) cout << " ";
        cout << vec[i];
    }
    cout << "\n";
}

int main() {
    cin.tie(0); ios::sync_with_stdio(false);
    int N; cin >> N;
    vector<vector<long long>> A(N, vector<long long>(N));
    vector<long long> G(N);
    rep(i, 0, N) rep(j, 0, N) cin >> A[i][j];
    rep(i, 0, N) {
        long long g = 0;
        rep(j, 0, N) if(A[i][j]) g = gcd(g, A[i][j]);
        G[i] = g;
    }
    vector<long long> a(N);
    vector<long long> ans(N);
    rep(i, 0, N) {
        rep(j, 0, N) {
            if(i == j) continue;
            a[j] = A[i][j] / G[i];
        }
    }
    rep(i, 0, N) {
        rep(j, 0, N) {
            if(i == j) continue;
            ans[j] = A[i][j] / a[i] * a[j];
            ans[j] = sqrt(ans[j]);
        }
    }
    print(ans);
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define rep(i, m, n) for (int i = m; i < n; ++i)

long long gcd(long long a, long long b) {
    if (a % b == 0) return b;
    return gcd(b, a % b);
}

long long lcm(long long a, long long b){
    return a / gcd(a, b) * b;
}

template<class T> void print(vector<T> &vec) {
    for(int i = 0; i < (int)vec.size(); ++i) {
        if(i) cout << " ";
        cout << vec[i];
    }
    cout << "\n";
}

int main() {
    cin.tie(0); ios::sync_with_stdio(false);
    int N; cin >> N;
    vector<vector<long long>> A(N, vector<long long>(N));
    vector<long long> G(N);
    rep(i, 0, N) rep(j, 0, N) cin >> A[i][j];
    rep(i, 0, N) {
        long long g = 0;
        rep(j, 0, N) if(A[i][j]) g = gcd(g, A[i][j]);
        G[i] = g;
    }
    vector<long long> ans(N);
    rep(i, 0, N) {
        rep(j, 0, N) {
            if(i == j) continue;
            long long b = G[i] * G[j] / A[i][j];
            ans[j] = A[i][j] / G[i];
        }
    }
    print(ans);
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define rep(i, m, n) for (int i = m; i < n; ++i)

template<class T> void print(vector<T> &vec) {
    for(int i = 0; i < (int)vec.size(); ++i) {
        if(i) cout << " ";
        cout << vec[i];
    }
    cout << "\n";
}

int main() {
    cin.tie(0); ios::sync_with_stdio(false);
    int N; cin >> N;
    vector<vector<long long>> A(N, vector<long long>(N));
    vector<long long> G(N);
    rep(i, 0, N) rep(j, 0, N) cin >> A[i][j];
    vector<long long> ans(N);
    rep(i, 0, N) {
        double m = (double)A[i][(i + 1) % N] * A[(i + 2) % N][i] / A[(i + 2) % N][(i + 1) % N];
        ans[i] = sqrt(m);
    }
    print(ans);
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define rep(i, m, n) for (int i = m; i < n; ++i)

template<class T> void print(vector<T> &vec) {
    for(int i = 0; i < (int)vec.size(); ++i) {
        if(i) cout << " ";
        cout << vec[i];
    }
    cout << "\n";
}

int main() {
    cin.tie(0); ios::sync_with_stdio(false);
    int N; cin >> N;
    vector<vector<long long>> A(N, vector<long long>(N));
    vector<long long> G(N);
    rep(i, 0, N) rep(j, 0, N) cin >> A[i][j];
    vector<long long> ans(N);
    rep(i, 0, N) {
        double m = (double)A[(i + 2) % N][i] / A[(i + 2) % N][(i + 1) % N];
        ans[i] = A[i][(i + 1) % N] * m;
        ans[i] = sqrt(ans[i]);
    }
    print(ans);
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define rep(i, m, n) for (int i = m; i < n; ++i)

long long gcd(long long a, long long b) {
    if (a % b == 0) return b;
    return gcd(b, a % b);
}

template<class T> void print(vector<T> &vec) {
    for(int i = 0; i < (int)vec.size(); ++i) {
        if(i) cout << " ";
        cout << vec[i];
    }
    cout << "\n";
}

int main() {
    cin.tie(0); ios::sync_with_stdio(false);
    int N; cin >> N;
    vector<vector<long long>> A(N, vector<long long>(N));
    vector<long long> G(N);
    rep(i, 0, N) rep(j, 0, N) cin >> A[i][j];
    rep(i, 0, N) {
        long long g = 0;
        rep(j, 0, N) if(A[i][j]) g = gcd(g, A[i][j]);
        G[i] = g;
    }
    vector<long long> ans(N);
    rep(i, 0, N) {
        rep(j, 0, N) {
            if(i == j) continue;
            ans[j] = A[i][j] / G[i];
        }
    }
    print(ans);
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define rep(i, m, n) for (int i = m; i < n; ++i)

template<class T> void print(vector<T> &vec) {
    for(int i = 0; i < (int)vec.size(); ++i) {
        if(i) cout << " ";
        cout << vec[i];
    }
    cout << "\n";
}

int main() {
    cin.tie(0); ios::sync_with_stdio(false);
    int N; cin >> N;
    vector<vector<long long>> A(N, vector<long long>(N));
    vector<long long> G(N);
    rep(i, 0, N) rep(j, 0, N) cin >> A[i][j];
    vector<long long> ans(N);
    rep(i, 0, N) {
        double m = (double)A[(i + 2) % N][i] / A[(i + 2) % N][(i + 1) % N];
        ans[i] = sqrt(A[i][(i + 1) % N] * m);
    }
    print(ans);
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define rep(i, m, n) for (int i = m; i < n; ++i)

long long gcd(long long a, long long b) {
    if (a % b == 0) return b;
    return gcd(b, a % b);
}

template<class T> void print(vector<T> &vec) {
    for(int i = 0; i < (int)vec.size(); ++i) {
        if(i) cout << " ";
        cout << vec[i];
    }
    cout << "\n";
}

int main() {
    cin.tie(0); ios::sync_with_stdio(false);
    int N; cin >> N;
    vector<vector<long long>> A(N, vector<long long>(N));
    vector<long long> G(N);
    rep(i, 0, N) rep(j, 0, N) cin >> A[i][j];
    rep(i, 0, N) {
        long long g = 0;
        rep(j, 0, N) if(A[i][j]) g = gcd(g, A[i][j]);
        G[i] = g;
    }
    vector<long long> a(N);
    vector<long long> ans(N);
    rep(i, 0, N) {
        rep(j, 0, N) {
            if(i == j) continue;
            a[j] = A[i][j] / G[i];
        }
    }
    long long b = A[0][1] / a[0] / a[1];
    b = sqrt(b);
    for(auto e : a) cout << e * b << " ";
    cout << endl;
    return 0;
}


          #include<bits/stdc++.h>
#include "windows.h"
using namespace std;
#define mp make_pair
#define pb push_back
#define ll unsigned long long
#define INF 1e18
//anoirchabchoub
#define strstring stringstream
string ch[100001][2];
ll dp[100001][2];
vector <ll> v(100001);
int t[100];

long long M[1001][1001];
long long a[1001];
int main()
{
    int n ;
cin>>n;
for(int i=0;i<n;i++)
    for(int j=0;j<n;j++)
    {
    cin>>M[i][j];
    }
a[0]=((M[0][1]*1.0)/M[1][2])*M[0][2];
a[0]=sqrt(a[0]);
for(int i =1;i<n;i++)
{
    a[i]=M[0][i]/a[0];
}
for(int i=0;i<n;i++)cout<<a[i]<<' ';
}


          #include<bits/stdc++.h>
#include "windows.h"
using namespace std;
#define mp make_pair
#define pb push_back
#define ll unsigned long long
#define INF 1e18
//anoirchabchoub
#define strstring stringstream
string ch[100001][2];
ll dp[100001][2];
vector <ll> v(100001);
int t[100];

long double M[1001][1001];
long double a[1001];
int main()
{
    int n ;
cin>>n;
for(int i=0;i<n;i++)
    for(int j=0;j<n;j++)
    {
    cin>>M[i][j];
    }
a[0]=((M[0][1]*1.0)/M[1][2])*M[0][2];
a[0]=sqrt(a[0]);
for(int i =1;i<n;i++)
{
    a[i]=(M[0][i]*1.0)/a[0];
}
for(int i=0;i<n;i++)cout<<a[i]<<' ';
}


          #include<bits/stdc++.h>
#include "windows.h"
using namespace std;
#define mp make_pair
#define pb push_back
#define ll unsigned long long
#define INF 1e18
//anoirchabchoub
#define strstring stringstream
string ch[100001][2];
ll dp[100001][2];
vector <ll> v(100001);
int t[100];

long long M[1001][1001];
long long a[1001];
int main()
{
    int n ;
cin>>n;
for(int i=0;i<n;i++)
    for(int j=0;j<n;j++)
    {
    cin>>M[i][j];
    }
a[0]=((M[0][1]*1.0)/M[1][2])*M[0][2];
a[0]=sqrt(a[0]);
for(int i =1;i<n;i++)
{
    a[i]=(M[0][i]*1.0)/a[0];
}
for(int i=0;i<n;i++)cout<<a[i]<<' ';
}


          #include<bits/stdc++.h>
#include "windows.h"
using namespace std;
#define mp make_pair
#define pb push_back
#define ll unsigned long long
#define INF 1e18
//anoirchabchoub
#define strstring stringstream
string ch[100001][2];
ll dp[100001][2];
vector <ll> v(100001);
int t[100];

int M[1001][1001];
float a[1001];
int main()
{
    int n ;
cin>>n;
for(int i=0;i<n;i++)
    for(int j=0;j<n;j++)
    {
    cin>>M[i][j];
    }
a[0]=((M[0][1]*1.0)/M[1][2])*M[0][2];
a[0]=sqrt(a[0]);
for(int i =1;i<n;i++)
{
    a[i]=(M[0][i]*1.0)/a[0];
}
for(int i=0;i<n;i++)cout<<a[i]<<' ';
}


          #include<bits/stdc++.h>
#include "windows.h"
using namespace std;
#define mp make_pair
#define pb push_back
#define ll unsigned long long
#define INF 1e18
//anoirchabchoub
#define strstring stringstream
string ch[100001][2];
ll dp[100001][2];
vector <ll> v(100001);
int t[100];

long long M[1001][1001];
long long a[1001];
int main()
{
    int n ;
cin>>n;
for(int i=0;i<n;i++)
    for(int j=0;j<n;j++)
    {
    cin>>M[i][j];
    }
a[0]=((M[0][1]*M[0][2])/M[1][2]);
a[0]=sqrt(a[0]);
for(int i =1;i<n;i++)
{
    a[i]=M[0][i]/a[0];
}
for(int i=0;i<n;i++)cout<<a[i]<<' ';
}


          #include<bits/stdc++.h>
#include "windows.h"
using namespace std;
#define mp make_pair
#define pb push_back
#define ll unsigned long long
#define INF 1e18
//anoirchabchoub
#define strstring stringstream
string ch[100001][2];
ll dp[100001][2];
vector <ll> v(100001);
int t[100];

double M[1001][1001];
double a[1001];
int main()
{
    int n ;
cin>>n;
for(int i=0;i<n;i++)
    for(int j=0;j<n;j++)
    {
    cin>>M[i][j];
    }
a[0]=((M[0][1]*1.0)/M[1][2])*M[0][2];
a[0]=sqrt(a[0]);
for(int i =1;i<n;i++)
{
    a[i]=(M[0][i]*1.0)/a[0];
}
for(int i=0;i<n;i++)cout<<a[i]<<' ';
}


          #include<bits/stdc++.h>
#include "windows.h"
using namespace std;
#define mp make_pair
#define pb push_back
#define ll unsigned long long
#define INF 1e18
//anoirchabchoub
#define strstring stringstream
string ch[100001][2];
ll dp[100001][2];
vector <ll> v(100001);
int t[100];

long long M[1001][1001];
long long a[1001];
int main()
{
    int n ;
cin>>n;
for(int i=0;i<n;i++)
    for(int j=0;j<n;j++)
    {
    cin>>M[i][j];
    }
a[0]=((M[0][1]*M[0][2])/M[1][2])
a[0]=sqrt(a[0]);
for(int i =1;i<n;i++)
{
    a[i]=M[0][i]/a[0];
}
for(int i=0;i<n;i++)cout<<a[i]<<' ';
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
bool works(ll x, vector<vector<ll>> &a)
{
    ll n=a[0].size();
    vector<ll> v;
    v.push_back(x);
    for(ll i=1;i<n;i++) v.push_back(a[i][0]/x);
    bool ok=true;
    for(ll i=0;i<n;i++)
    {
        for(ll j=0;j<n;j++)
        {
            if(i==j) continue;
            if(a[i][j]!=v[i]*v[j]) ok=false;
        }
    }
    return ok;
}
int main()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    ll n;
    cin>>n;
    vector<vector<ll>> a(n,vector<ll> (n));
    for(ll i=0;i<n;i++)
    for(ll j=0;j<n;j++)
    cin>>a[i][j];

    for(ll i=1;i*i<=a[0][1];i++)
    {
        if(a[0][0]%i) continue;
        if(works(i,a))
        {
            cout<<i<<" ";
            for(ll j=1;j<n;j++) cout<<a[j][0]/i<<" ";
            cout<<"\n";
            return 0;
        }
        if(works(a[0][1]/i,a))
        {
            ll x=a[0][0]/i;
            cout<<x<<" ";
            for(ll j=1;j<n;j++) cout<<a[j][0]/x<<" ";
            cout<<"\n";
            return 0;
        }
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
bool works(ll x, vector<vector<ll>> &a)
{
    ll n=a[0].size();
    vector<ll> v;
    v.push_back(x);
    for(ll i=1;i<n;i++) v.push_back(a[i][0]/x);
    bool ok=true;
    for(ll i=0;i<n;i++)
    {
        for(ll j=0;j<n;j++)
        {
            if(i==j) continue;
            if(a[i][j]!=v[i]*v[j]) ok=false;
        }
    }
    return ok;
}
int main()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    ll n;
    cin>>n;
    vector<vector<ll>> a(n,vector<ll> (n));
    for(ll i=0;i<n;i++)
    for(ll j=0;j<n;j++)
    cin>>a[i][j];

    for(ll i=1;i*i<=a[1][0];i++)
    {
        if(a[1][0]%i) continue;
        if(works(i,a))
        {
            cout<<i<<" ";
            for(ll j=1;j<n;j++) cout<<a[j][0]/i<<" ";
            cout<<"\n";
            return 0;
        }
        if(works(a[1][0]/i,a))
        {
            ll x=a[1][0]/i;
            cout<<x<<" ";
            for(ll j=1;j<n;j++) cout<<a[j][0]/x<<" ";
            cout<<"\n";
            return 0;
        }
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
int main()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    ll n;
	cin>>n;
	vector<vector<ll>> a(n, vector<ll> (n));
	for(ll i=0;i<n;i++)
    {
        for(ll j=0;j<n;j++) cin>>a[i][j];
    }
	ll x=a[0][1]*a[0][2]/a[1][2];
	x=(ll)sqrt(x);
	cout<<x<<" ";
	for(ll i=1;i<n;i++) cout<<a[0][i]/x<<" ";
	cout<<'\n';
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
int main()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    ll n;
    cin>>n;
    ll a[n][n];
    for(ll i=0;i<n;i++)
    for(ll j=0;j<n;j++)
    cin>>a[i][j];
    for(ll i=0;i<n;i++)
    {
        ll z=0;
        for(ll j=0;j<n;j++)
        {
            if(j==i) continue;
            z=__gcd(z,a[i][j]);
        }
        ll y=0;
        for(ll j=0;j<n;j++)
        {
            if(j==i) continue;
            y=__gcd(y,a[j][i]);
        }
        cout<<z*y<<" ";
    }
    cout<<'\n';
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
int main()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    ll n;
    cin>>n;
    ll a[n][n];
    for(ll i=0;i<n;i++)
    for(ll j=0;j<n;j++)
    cin>>a[i][j];
    vector<ll> r;
    for(ll i=0;i<n;i++)
    {
        ll z=0;
        for(ll j=0;j<n;j++)
        {
            if(j==i) continue;
            z=__gcd(z,a[i][j]);
        }
        ll y=0;
        for(ll j=0;j<n;j++)
        {
            if(j==i) continue;
            y=__gcd(y,a[j][i]);
        }
        r.push_back(z*y);
    }
    for(auto i: r) cout<<sqrt(i)<<" ";
    cout<<'\n';
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
int main()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    ll n;
    cin>>n;
    ll a[n][n];
    for(ll i=0;i<n;i++)
    for(ll j=0;j<n;j++)
    cin>>a[i][j];
    ll g=0;
	for(ll i=1;i<n;i++) g=__gcd(g,a[i][0]);
	cout<<g<<" ";
	for(ll i=1;i<n;i++) cout<<a[i][0]/g<<" ";
	cout<<'\n';
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
int main()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    ll n;
    cin>>n;
    ll a[n][n];
    for(ll i=0;i<n;i++)
    for(ll j=0;j<n;j++)
    cin>>a[i][j];
    vector<ll> r,c;
    for(ll i=0;i<n;i++)
    {
        ll z=0;
        for(ll j=0;j<n;j++)
        {
            if(j==i) continue;
            z=__gcd(z,a[i][j]);
        }
        cout<<z<<" ";
    }
    cout<<'\n';
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long int ll;

int main()
{
	ll n;
	cin>>n;
	ll a[n][n],k;
	for(ll i=0;i<n;i++)
	for(ll j=0;j<n;j++)
	cin>>a[i];
	k=sqrt((a[0][1]*a[0][2])/a[1][2]);
	cout<<k<<" ";
	for(ll i=1;i<n;i++) cout<<a[0][i]/k<<" ";
	cout<<endl;
}


#include<bits/stdc++.h>
using namespace std;
typedef long int ll;

int main()
{
	ll n;
	cin>>n;
	ll a[n][n],k;
	for(ll i=0;i<n;i++) for(ll j=0;j<n;j++)  cin>>a[i][j];
	k=(a[0][1]*a[0][2])/a[1][2];
	k=sqrt(k);
	cout<<k<<" ";
	for(ll i=1;i<n;i++) cout<<a[0][i]/k<<" ";
	cout<<endl;
return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long int ll;

int main()
{
	ll n;
	cin>>n;
	ll a[n][n],k;
	for(ll i=0;i<n;i++) for(ll j=0;j<n;j++)  cin>>a[i];
	k=sqrt((a[0][1]*a[0][2])/a[1][2]);
	cout<<k<<" ";
	for(ll i=1;i<n;i++) cout<<a[0][i]/k<<" ";
	cout<<endl;
}


#include<bits/stdc++.h>
using namespace std;
typedef long int ll;

int main()
{
	ll n;
	cin>>n;
	ll a[n][n],k;
	for(ll i=0;i<n;i++) for(ll j=0;j<n;j++)  cin>>a[i][j];
	k=(ll)sqrt((a[0][1]*a[0][2])/a[1][2]);
	cout<<k<<" ";
	for(ll i=1;i<n;i++) cout<<a[0][i]/k<<" ";
	cout<<endl;
}


#include<bits/stdc++.h>
using namespace std;
typedef long int ll;

int main()
{
	ll n;
	cin>>n;
	ll a[n][n],k;
	for(ll i=0;i<n;i++) for(ll j=0;j<n;j++)  cin>>a[i][j];
	k=sqrt((a[0][1]*a[0][2])/a[1][2]);
	cout<<k<<" ";
	for(ll i=1;i<n;i++) cout<<a[0][i]/k<<" ";
	cout<<endl;
}


import java.util.List;
import java.io.InputStreamReader;
import java.io.IOException;
import java.util.ArrayList;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.math.BigInteger;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author AlexFetisov
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskD solver = new TaskD();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskD {
    final static int MOD = (int) 1e9 + 7;

    int k;

    public void solve(int testNumber, InputReader in, PrintWriter out) {
        int n = in.nextInt();
        k = in.nextInt();
        int[][][] dp = new int[n + 1][1 << k][2];
        dp[0][0][0] = 1;
        int[] seq = Utils.readIntArray(in, n);

        for (int i = 0; i < n; ++i) {
            for (int mask = 0; mask < (1 << k); ++mask) {
                for (int was = 0; was <= 1; ++was) {
                    if (dp[i][mask][was] != 0) {
                        int cur = dp[i][mask][was];
                        if (seq[i] == 2 || seq[i] == 0) {
                            Pair<Integer, Integer> next = add(mask, 1);
                            dp[i + 1][next.first][Math.max(next.second, was)] += cur;
                            if (dp[i + 1][next.first][Math.max(next.second, was)] >= MOD) {
                                dp[i + 1][next.first][Math.max(next.second, was)] -= MOD;
                            }
                        }
                        if (seq[i] == 4 || seq[i] == 0) {
                            Pair<Integer, Integer> next = add(mask, 2);
                            dp[i + 1][next.first][Math.max(next.second, was)] += cur;
                            if (dp[i + 1][next.first][Math.max(next.second, was)] >= MOD) {
                                dp[i + 1][next.first][Math.max(next.second, was)] -= MOD;
                            }
                        }
                    }
                }
            }
        }
        int res = 0;
        for (int mask = 0; mask < (1 << k); ++mask) {
            res += dp[n][mask][1];
            if (res >= MOD) {
                res -= MOD;
            }
        }
        out.println(res);
    }

    Pair<Integer, Integer> add(int mask, int x) {
        List<Integer> suffix = new ArrayList<Integer>();
        suffix.add(x);
        for (int i = 0; i < k; ++i) {
            if (BitUtils.checkBit(mask, i)) {
                suffix.add(i);
            }
        }
        while (true) {
            if (suffix.size() == 1) break;
            x = suffix.get(0);
            int y = suffix.get(1);
            if (x == y) {
                suffix.set(0, x + 1);
                suffix.remove(1);
            } else {
                break;
            }
        }
        if (suffix.size() == 1 && suffix.get(0) == k) {
            return Pair.makePair(0, 1);
        }
        int newMask = (1 << suffix.get(0));
        for (int i = 1; i < suffix.size(); ++i) {
            if (suffix.get(i) < suffix.get(i - 1)) {
                break;
            }
            newMask |= (1 << suffix.get(i));
        }
        return Pair.makePair(newMask, 0);
    }
}

class InputReader {
    private BufferedReader reader;
    private StringTokenizer stt;

    public InputReader(InputStream stream) {
        reader = new BufferedReader(new InputStreamReader(stream));
    }

    public String nextLine() {
        try {
            return reader.readLine();
        } catch (IOException e) {
            return null;
        }
    }

    public String nextString() {
        while (stt == null || !stt.hasMoreTokens()) {
            stt = new StringTokenizer(nextLine());
        }
        return stt.nextToken();
    }

    public int nextInt() {
        return Integer.parseInt(nextString());
    }

}

class Utils {
    public static int[] readIntArray(InputReader in, int n) {
        int[] a = new int[n];
        for (int i = 0; i < n; ++i) {
            a[i] = in.nextInt();
        }
        return a;
    }

}

class Pair<U, V> implements Comparable<Pair<U, V>> {
    public final U first;
    public final V second;

    public static<U, V> Pair<U, V> makePair(U first, V second) {
        return new Pair<U, V>(first, second);
    }

    public Pair(U first, V second) {
        this.first = first;
        this.second = second;
    }

    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        Pair pair = (Pair) o;

        return !(first != null ? !first.equals(pair.first) : pair.first != null) && !(second != null ? !second.equals(pair.second) : pair.second != null);

    }

    public int hashCode() {
        int result = first != null ? first.hashCode() : 0;
        result = 31 * result + (second != null ? second.hashCode() : 0);
        return result;
    }

    public String toString() {
        return "(" + first + "," + second + ")";
    }

    public int compareTo(Pair<U, V> o) {
        int value = ((Comparable<U>)first).compareTo(o.first);
        if (value != 0)
            return value;
        return ((Comparable<V>)second).compareTo(o.second);
    }
}

class BitUtils {
    public static boolean checkBit(int mask, int bit) {
        return (mask & (1 << bit)) > 0;
    }

}


import java.io.*;
import java.util.*;

public class CF413D {
	static int M = 1000000007, k;
	static int[][] dp;
	static void update(int a, int b, int i) {
		int c = b == 0 ? 0 : b - (b & b - 1);	// least significant bit
		int b_ = a > c ? a : (b + a) % (1 << k);
		dp[b_][i + 1] = (dp[b_][i + 1] + dp[b][i]) % M;
	}
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer(br.readLine());
		int n = Integer.parseInt(st.nextToken());
		k = Integer.parseInt(st.nextToken());
		st = new StringTokenizer(br.readLine());
		int[] aa = new int[n];
		for (int i = 0; i < n; i++)
			aa[i] = Integer.parseInt(st.nextToken());
		dp = new int[1 << k][n + 1];
		dp[0][0] = 1;
		for (int i = 0; i < n; i++)
			for (int b = i == 0 ? 0 : 1; b < 1 << k; b++)
				if (dp[b][i] > 0) {
					if (aa[i] == 0) {
						update(2, b, i);
						update(4, b, i);
					} else
						update(aa[i], b, i);
				}
		long sum = 0, z = 1;
		for (int i = n; i >= 1; i--) {
			sum = (sum + dp[0][i] * z) % M;
			if (aa[i - 1] == 0)
				z = z * 2 % M;
		}
		System.out.println(sum);
	}
}