#include <iostream>
using namespace std;

string swith;
string snum[] = {  "0111111",  "0000110",  "1011011","1001111",
		   "1100110",  "1101101",  "1111101",  "0100111",
		   "1111111",  "1101111",  "1000110"};

void kirikae(int a){
  for(int i = 0 ; i < 7 ; i++){
    if(snum[a][i] != swith[i])cout << "1";
    else cout << "0";
  }
  cout << endl;
  swith = snum[a];
}

int main(){
  int n;

  while( cin >> n ){

    if(n == -1)break;
    swith = "0000000";
    for(int i = 0 ; i < n ; i++){
      int num;
      cin >> num;
      if(num == -1)num = 10;
      kirikae(num);
    }
  }
  return 0;
}