#include <iostream>
#include <vector>
#include <bitset>

using namespace std;

int main() {
    int n,i,j,k=0,temp;
    int pair[11]={
            0b0111111,0b0000110,0b1011011,0b1001111,0b1100110,0b1101101,0b1111101,0b0100111,0b1111111,0b1101111,0b0000000
    };
    vector<int> xtemp;
    vector<vector<int>> x(0,vector<int>());
    do{

        vector<int> xtemp;
        xtemp.push_back(10);
        cin>>j;
        if(j==-1)break;
        for(i=0;i<j;i++){
            cin>>temp;
            xtemp.push_back(temp);
        }
        x.push_back(xtemp);
    }while(temp!=-1);
    for(j=0;j<x.size();j++) {
        for (i = 1; i < x[j].size(); i++) {
            cout << bitset<7>((pair[(unsigned int)x[j][i]]^pair[(unsigned int)x[j][i-1]])) << endl;
        }
    }

   // std::cout << "Hello, World!" << std::endl;
    return 0;
}
