dic = {0:"0111111", 1:"0000110", 2:"1011011", 3:"1001111", 4:"1100110",
       5:"1101101", 6:"1111101", 7:"0100111", 8:"1111111", 9:"1101111"}

while True:
  n = int(input())
  if n == -1:
    break
  dig = "0" * 7
  for _ in range(n):
    d = dic[int(input())]
    put = ""
    for i in range(7):
      if dig[i] != d[i]:
        put += "1"
      else:
        put += "0"
    print(put)
    dig = d
