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

constexpr int D[]={
    0b0111111,
    0b0000110,
    0b1011011,
    0b1001111,
    0b1100110,
    0b1101101,
    0b1111101,
    0b0100111,
    0b1111111,
    0b1101111
};

bool solve(){
    int n;
    cin >> n;
    if(n == -1) return false;
    int S = 0;
    for(int i=0;i<n;i++){
        int d;
        cin >> d;
        cout << bitset<7>(S^D[d]) << endl;
        S = D[d]; 
    }
    return true;
}

int main() {
    while(solve());
    return 0;
}

