#include <cstdio>
#include <algorithm>
using namespace std;
int bin[7];

void decToBinary(int num) {
    fill(bin, bin+7, 0);
    int i = 6;
    while (num > 0) {
        bin[i] = num % 2;
        num /= 2;
        i--;
    }
    for (i = 0; i < 7; i++) printf("%d", bin[i]);
    printf("\n");
}


int main()
{
    int nums[10] = {63, 6, 91, 79, 102, 109, 125, 39, 127, 111};
    int n, curr, prev, change;
    for (; ;) {
        scanf("%d", &n);
        if (n == -1) break;
        scanf("%d", &prev);
        decToBinary(nums[prev]);
        for (int i = 1; i < n; i++) {
            scanf("%d", &curr);
            change = nums[prev] ^ nums[curr];
            decToBinary(change);
            prev = curr;
        }
    }
    return 0;
}

