#include <iostream>
using namespace std;

const string numbers[10] = {
    "0111111",
    "0000110",
    "1011011",
    "1001111",
    "1100110",
    "1101101",
    "1111101",
    "0100111",
    "1111111",
    "1101111"
};

string convert( int k, string prev )
{
    string answer;
    for ( int i = 0; i < 7; i++ ) {
        if ( numbers[k][i] == prev[i] ) {
            answer += '0';
        } else {
            answer += '1';
        }
    }
    return answer;
}

int main( void )
{
    int n;
    while ( cin >> n && n != -1 ) {
        string prev = "0000000";
        for ( int i = 0; i < n; i++ ) {
            int k;
            cin >> k;
            cout << convert( k, prev ) << endl;
            prev = numbers[k];
        }
    }
    return 0;
}