def signal(a,e):
	s=""
	for i in range(7):
		s+="0" if a[i]==e[i] else "1"
	return s
		

ref=["0111111","0000110","1011011","1001111","1100110","1101101","1111101","0100111","1111111","1101111"]
while 1:
	n=input()
	if n==-1:break
	e="0000000"
	for i in range(n):
		a=ref[int(raw_input())]
		print signal(a,e)
		e=a