Num_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
    num_b = int(input())
    seg = ""
    for h in range(7):
        seg = seg + str(Num_seg[num_b][h])
    
    print(seg)
    for i in range(n - 1):
        num_a = int(input())
        seg = ""
        for j in range(7):
            if Num_seg[num_b][j] == Num_seg[num_a][j]:
                seg = seg + "0"
            else:
                seg = seg + "1"
        num_b = num_a
    
        print(seg)