#include <stdio.h>

void printBin(int n, int d);

int main(void){
    int ptn[] = {63, 6, 91, 79, 102, 109, 125, 39, 127, 111};
    int cur, next, n;
    
    while(scanf("%d",&n), n!=-1){
        cur=0;
        for (int i=0; i<n; i++){
            scanf("%d", &next);
            printBin(cur^ptn[next], 7);
            printf("\n");
            cur = ptn[next];
        }
    }
    return 0;
}

void printBin(int n, int d){
    for (d--; d>=0; d--){
        printf("%d", (n>>d)&1);
    } 
}