#include <iostream>
#include <string>
using namespace std;

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

int main()
{
    while(1)
    {
        int n;
        int cur_d;
        int pre_d = 10;
        cin >> n;
        if(n == -1)
        {
            break;
        }
        for(int i=0; i<n; i++)
        {
            string ans;
            cin >> cur_d;
            
            for(int j=0; j<7; j++)
            {
                if(number_bits[cur_d][j] == number_bits[pre_d][j])
                {
                    ans += "0";
                }
                else
                {
                    ans += "1";
                }
            }
            pre_d = cur_d;
            cout << ans << endl;
        }
    }
    return 0;
}