#include<iostream>
#include<vector>
#include<algorithm>
#include<bitset>
using namespace std;
int main(){
    int latte[]={
        0b0111111,0b0000110,0b1011011,0b1001111,0b1100110,
        0b1101101,0b1111101,0b0100111,0b1111111,0b1101111,
    };

    int n;
    while(cin>>n,n!=-1){
        int l=0;
        while(n--){
            int cafe;
            cin>>cafe;
            int p=l^latte[cafe];
            l=latte[cafe];
            for(int i=6;i>=0;i--){
                cout<<((p>>i)&1);
            }
            cout<<endl;
        }
    }
    return 0;
}