def prog():
	n = int(input())
	a = int(input())
	s = 2*(10**n)+a
	print(s)
	b = int(input())
	c = (10 ** n)-b
	print(c)
	d = int(input())
	e = (10 ** n) - d
	print(e)





test = int(input())
for _ in range(0,test):
	prog()
	int(input())