dig = ["0111111","0000110","1011011","1001111","1100110","1101101","1111101","0100111","1111111","1101111"]
dc = [ ["".join(str(int(dig[i][k])^int(dig[j][k])) for k in range(7)) for j in range(10)] for i in range(10)]
while 1:
    n = input()
    if n==-1: break
    buf = -1
    for i in range(n):
        num = input()
        if buf==-1:
            print dig[num]
        else:
            print dc[buf][num]
        buf = num