seg = [[0, 1, 1, 1, 1, 1, 1],
[0, 0, 0, 0, 1, 1, 0], 
[1, 0, 1, 1, 0, 1, 1], 
[1, 0, 0, 1, 1, 1, 1],
[1, 1, 0, 0, 1, 1, 0], 
[1, 1, 0, 1, 1, 0, 1], 
[1, 1, 1, 1, 1, 0, 1], 
[0, 1, 0, 0, 1, 1, 1], 
[1, 1, 1, 1, 1, 1, 1], 
[1, 1, 0, 1, 1, 1, 1]]

while True :
    n = int(input())
    if n == -1 :
        break
    pre = [0]*7
    for i in range(n) :
        num = int(input())
        post = seg[num]
        for j in range(7) :
            if pre[j] == post[j] :
                print(0, end='')
            else :
                print(1, end='')
        print()
        pre = post
