// This file is a "Hello, world!" in C++ language by GCC for wandbox.
#include <iostream>
#include <cstdlib>
#include <vector>
#include <bitset>
using namespace std;
int main()
{
    vector<int> seg  {0b0111111,0b0000110,0b1011011,0b1001111,0b1100110,0b1101101,0b1111101,0b0100111,0b1111111,0b1101111};
      int n;
    while(true){
        cin>>n;
        if(n==-1){
        break;
        }
    vector<int> vec(n);
    for(int i=0;i<n;i++){
    cin>>vec.at(i);
    }
    cout<<bitset<7>(seg.at(vec.at(0)))<<endl;
   for(int i=1;i<n;i++){
       cout<<bitset<7>(seg.at(vec.at(i))^seg.at(vec.at(i-1)))<<endl;
   }
    }
    
}

// GCC reference:
//   https://gcc.gnu.org/

// C++ language references:
//   https://cppreference.com/
//   https://isocpp.org/
//   http://www.open-std.org/jtc1/sc22/wg21/

// Boost libraries references:
//   https://www.boost.org/doc/


