Seg = [
  0b0111111,
  0b0000110,
  0b1011011,
  0b1001111,
  0b1100110,
  0b1101101,
  0b1111101,
  0b0100111,
  0b1111111,
  0b1101111
]

while (n = $stdin.gets.to_i) != -1 do
  prev = 0b0000000
  n.times do
    nextNumber = Seg[$stdin.gets.to_i]
    printf("%07d\n", (prev ^ nextNumber).to_s(2))
    prev = nextNumber
  end
end