#include<bits/stdc++.h>
using namespace std;

int main(){
    int N;
    while(cin >> N, N != -1){
        string now = "0000000";
        for(int i = 0; i < N; i++){
            int k;
            cin >> k;
            string S;
            if(k == 0) S = "0111111";
            if(k == 1) S = "0000110";
            if(k == 2) S = "1011011";
            if(k == 3) S = "1001111";
            if(k == 4) S = "1100110";
            if(k == 5) S = "1101101";
            if(k == 6) S = "1111101";
            if(k == 7) S = "0100111";
            if(k == 8) S = "1111111";
            if(k == 9) S = "1101111";

            string ans = "0000000";
            for(int i = 0;i < ans.size(); i++){
                if(now[i] != S[i]) ans[i] = '1';
            }
            now = S;
            cout << ans << endl;
        }
    }
    
}
