#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

int main()
{
    string num[] = {"0111111", "0000110", "1011011", "1001111", "1100110",
                    "1101101", "1111101", "0100111", "1111111", "1101111"};

    for(;;){
        int n;
        cin >> n;
        if(n == -1)
            return 0;

        bitset<7> bs(0);
        for(int i=0; i<n; ++i){
            int a;
            cin >> a;
            cout << (bs ^ bitset<7>(num[a])).to_string() << endl;
            bs = bitset<7>(num[a]);
        }
    }
}