#include <iostream>

using namespace std;

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

    while (cin >> n, n != -1) {
        int bf = 10;

        for (int i = 0; i < n; i++) {
            int inp;
            string ans;

            cin >> inp;            
            for (int i = 0; i < 7; i++)
                if (num[inp][i] != num[bf][i]) 
                    ans.push_back('1');
                else
                    ans.push_back('0');
            cout << ans << endl;

            bf = inp;
        }
    }

    return 0;
}