# AOJ 0228: Seven Segments
# Python3 2018.6.25 bal4u

p = [[1,1,1,1,1,1,0], [0,1,1,0,0,0,0], [1,1,0,1,1,0,1], [1,1,1,1,0,0,1], [0,1,1,0,0,1,1], \
     [1,0,1,1,0,1,1], [1,0,1,1,1,1,1], [1,1,1,0,0,1,0], [1,1,1,1,1,1,1], [1,1,1,1,0,1,1]]

while True:
	n = int(input())
	if n < 0: break
	a = [0]*7
	for i in range(n):
		d = int(input())
		ans = ''
		for j in range(6,-1,-1):
			k = (a[j] ^ p[d][j]) & 1
			ans += '1' if k else '0'
			if k: a[j] = 1-a[j]
		print(ans)
