#include <iostream>
using namespace std;

int table[10][7] = {
    {0,1,1,1,1,1,1},//0
    {0,0,0,0,1,1,0},//1
    {1,0,1,1,0,1,1},//2
    {1,0,0,1,1,1,1},//3
    {1,1,0,0,1,1,0},//4
    {1,1,0,1,1,0,1},//5
    {1,1,1,1,1,0,1},//6
    {0,1,0,0,1,1,1},//7
    {1,1,1,1,1,1,1},//8
    {1,1,0,1,1,1,1} //9
};

int main(void){
    // Your code here!
    int n;
    while(true) {
        cin >> n;
        if(n == -1) break;
        
        int k;
        int display[7] = {0,0,0,0,0,0,0};
        for(int i = 0; i < n; i++){
            cin >> k;
            for(int j = 0; j < 7; j++) {
                if(display[j] == table[k][j]) {
                    cout << 0;
                } else {
                    display[j] = table[k][j];
                    cout << 1;
                }
            }
            cout << endl;
        }
    }
}

