#include<iostream>
#include<vector>
#include<string>
#include<algorithm>

using namespace std;

int main()
{
  vector<string> vs;
  vs.push_back("1111110");

  vs.push_back("0110000");
  vs.push_back("1101101");
  vs.push_back("1111001");
  vs.push_back("0110011");
  vs.push_back("1011011");

  vs.push_back("1011111");
  vs.push_back("1110010");
  vs.push_back("1111111");
  vs.push_back("1111011");

  while(true){
    int n;
    scanf("%d", &n);
    if(n==-1)break;
    string state = "0000000";
    for(int i = 0; i < n; ++i){
      int d;
      scanf("%d", &d);
      string signal;
      for(int j = 0; j < 7; ++j){
	if(state[j]!=vs[d][j]){
	  signal += '1';
	}else{
	  signal += '0';
	}
      }
      reverse(signal.begin(),signal.end());
      printf("%s\n", signal.c_str());
      state = vs[d];
    }

  }
  
  return 0;
}