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

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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);

    int n;
    while(cin >> n && n != -1){
        int prev = 0;
        for(int i = 0; i < n; ++i){
            int a;
            cin >> a;
            if(i == 0){
                cout << number[a] << endl;
            }
            else {
                for(int j = 0; j < 7; ++j){
                    if(number[prev][j] == number[a][j])
                        cout << 0;
                    else
                        cout << 1;
                }
                cout << endl;
            }
            prev = a;
        }
    }

   return 0;
}