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

int main(){
    int n;
    vector<int> seg{0b0111111,0b0000110,0b1011011,0b1001111,0b1100110,0b1101101,0b1111101,0b0100111,0b1111111,0b1101111};
    while(1){
        cin>>n;
        if(n==-1){
            return 0;
        }
        vector<int> d(n);
        int x = 0;
        for(int i=0;i<n;i++){
            cin>>d.at(i);
        }
        for(int i=0;i<n;i++){
            int y=x^seg.at(d.at(i));
            cout<<(bitset<7>(y))<<endl;
            x = seg.at(d.at(i));
        }
    }
}
