D={0: '0111111', 1: '0000110', 2: '1011011', 3: '1001111', 4: '1100110', 5: '1101101', 6: '1111101', 7: '0100111', 8: '1111111\
', 9: '1111110'}
while True:
    n=input()
    if n==-1:break
    t="0000000"
    for i in range(n):
        a=input()
        print "".join(["1" if i<>j else "0" for i,j in zip(D[a],t)])
        t=D[a]