hash = {0=>0b0111111,1=>0b0000110,2=>0b1011011,3=>0b1001111,4=>0b1100110,5=>0b1101101,6=>0b1111101,7=>0b0100111,8=>0b1111111,9=>0b1101111,10=>0b0000000}
loop do
  n =gets.to_i
  break if n==-1
  now = 10
  n.times do
    puts "%07b\n" % (hash[now] ^ hash[now = gets.to_i])
  end
end