s=[0b0111111,0b0000110,0b1011011,0b1001111,0b1100110,0b1101101,0b1111101,0b0100111,0b1111111,0b1101111]
while 1:
    n=int(input())
    if n<0:break
    a=0
    for _ in range(n):
        b=int(input())
        print(bin(a^s[b])[2:].zfill(7))
        a=s[b]