#include<iostream>
using namespace std;

int main()
{
    bool s[11][7] = {{0,1,1,1,1,1,1},{0,0,0,0,1,1,0},{1,0,1,1,0,1,1},{1,0,0,1,1,1,1},{1,1,0,0,1,1,0},
                     {1,1,0,1,1,0,1},{1,1,1,1,1,0,1},{0,1,0,0,1,1,1},{1,1,1,1,1,1,1},{1,1,0,1,1,1,1},{0,0,0,0,0,0,0}};
    int n, d;

    while( cin >> n )
    {
        if( n == -1 )
            break;

        for( int i = 0; i < 7; i++ )
            s[10][i] = 0;
        
        for( int i = 0; i < n; i++ )
        {
            cin >> d;
            for( int j = 0; j < 7; j++ )
            {
                bool a = s[d][j] ^ s[10][j];
                cout << a;
                s[10][j] = s[d][j];
            }
            cout << endl;
        }
    }
    return 0;
}

