import sys
f = sys.stdin

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

while True:
    n = int(f.readline())
    if n == -1:
        break
        
    display = 0
    for i in [int(f.readline()) for _ in range(n)]:
        print(bin(display ^ segment[i])[2:].zfill(7))
        display = segment[i]
    