#!/usr/bin/env python3

seven_seg = {
        0: '0111111',
        1: '0000110',
        2: '1011011',
        3: '1001111',
        4: '1100110',
        5: '1101101',
        6: '1111101',
        7: '0100111',
        8: '1111111',
        9: '1101111'
        }

while True:
    seven_seg_state = ['0'] * 7
    n = int(input())
    if n == -1:
        break
    for _ in range(n):
        in_data = int(input())
        for i in range(7):
            if seven_seg[in_data][i] == seven_seg_state[i]:
                print("0", end="")
            else:
                print("1", end="")
            seven_seg_state[i] = seven_seg[in_data][i]

        print()