#include<iostream>
#include<string>

using namespace std;

int main(){
  int j, i, n, previous, present;
  string answer, signal[11];

  signal[0] = "0111111";
  signal[1] = "0000110";
  signal[2] = "1011011";
  signal[3] = "1001111";
  signal[4] = "1100110";
  signal[5] = "1101101";
  signal[6] = "1111101";
  signal[7] = "0100111";
  signal[8] = "1111111";
  signal[9] = "1101111";
  signal[10] = "0000000";

  while(1){
    cin >> n;
    if(n == -1) break;

    previous = 10;
    for(i=0; i<n; ++i){
      cin >> present;

      for(j=0; j<7; ++j){
	if(signal[present][j] == signal[previous][j])
	  cout << "0";
	else
	  cout << "1";
      }
      cout << endl;
      previous = present;
    }
  }

  return 0;
}