#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    string show[]={"0111111","0000110","1011011",
    "1001111","1100110","1101101","1111101","0100111","1111111","1101111"};
    while(cin>>n&&n!=-1){
        string str="0000000";
        for(int i=0,num;i<n;i++){
            cin>>num;
            for(int j=0;j<7;j++){
                if(str[j]==show[num][j])cout<<"0";
                else cout<<"1";
            }
            cout<<endl;
            str=show[num];
        }
    }
}