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

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

int main()
{
    int c, n;
    while(cin >> c && c > 0) {
        string s = "0000000";
        for(int i = 0; i < c; i++) {
            cin >> n;
            string op = "0000000";
            for(int k = 0; k < 7; k++) {
                if(s[k] == segment[n][k]) {
                    op[k] = '0';
                } else {
                    op[k] = '1';
                }
            }
            s = segment[n];
            cout << op << endl;
        }
    }
}