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

int main() {
    int n;
    while(cin >> n, n != -1) {
        bitset<7> s[10] = {0b0111111, 0b0000110, 0b1011011, 0b1001111, 0b1100110, 0b1101101, 0b1111101, 0b0100111, 0b1111111, 0b1101111};
        bitset<7> now(0);
        for(int i=0; i<n; ++i) {
            int d;
            cin >> d;
            cout << (now ^ s[d]) << endl;
            now = s[d];
        }
    }
}
