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

int main(){
    while(1){    
        int n;
        cin >> n;
        if(n==-1) break;
        vector<int> seg(10,0);
        seg.at(0)=0b0111111;
        seg.at(1)=0b0000110;
        seg.at(2)=0b1011011;
        seg.at(3)=0b1001111;
        seg.at(4)=0b1100110;
        seg.at(5)=0b1101101;
        seg.at(6)=0b1111101;
        seg.at(7)=0b0100111;
        seg.at(8)=0b1111111;
        seg.at(9)=0b1101111;
        vector<int> data(n+1,0);
        vector<int> out(n,0);
        for(int i=0;i<n;i++){
            cin >> data.at(i+1);
            data.at(i+1)=seg.at(data.at(i+1));
        }
        for(int j=0;j<n;j++){
            out.at(j)=data.at(j)^data.at(j+1);
        cout << bitset<7>(out.at(j)) << endl;
        }
    }    
}

