#include<iostream>
using namespace std;
int main(){

    bool data[10][7]={
                    {1,1,1,1,1,1,0},
                    {0,1,1,0,0,0,0},
                    {1,1,0,1,1,0,1},
                    {1,1,1,1,0,0,1},
                    {0,1,1,0,0,1,1},
                    {1,0,1,1,0,1,1},
                    {1,0,1,1,1,1,1},
                    {1,1,1,0,0,1,0},
                    {1,1,1,1,1,1,1},
                    {1,1,1,1,0,1,1}};
    int n;
    while(cin>>n,n!=-1){
        bool now[7]={0,0,0,0,0,0,0};
        for(int i=0;i<n;i++){
            int x;
            cin>>x;

            for(int i=6;i>=0;i--){
                if(now[i]!=data[x][i]){
                    now[i]=1-now[i];
                    cout<<1;
                }
                else cout<<0;
            }
            cout<<endl;
        }
    }
    return 0;
}