#include <vector>
#include <iostream>
#include <bitset>

using namespace std;


int main(){
    while(1){
    int a;
    vector<int> seg  {0b0111111,0b0000110,0b1011011,0b1001111,0b1100110,0b1101101,0b1111101,0b0100111,0b1111111,0b1101111};
    cin >> a;
    if(a == -1){
        
        return 0;
    }else{
        int b,c,d;
        c = 0b0000000;
        
    for(int i=0;i<a;i++){
        
        cin >>b;
        d = seg[b]^c;
        cout << bitset<7>(d) <<endl;
        c = seg[b];
    }
    }
    }
}
