#include <iostream>
#include <string>
using namespace std;

int main() {

  int g,f,e,d,c,b,a;

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

  string ima,mae;
  mae.resize(7);
  ima.resize(7);


  int qu;
  while(1) {
  cin >> qu;
  if(qu == -1) break;
  for(int i=0;i<7;i++) ima[i] = '0';
  int n = 0;
  for(int j=0;j<qu;j++) {
    cin >> n;
    

    for(int i=0;i<7;i++) {
      if(num[n][i] != ima[i]) ima[i] = '1';
      else ima[i] = '0';
    }
   
    for(int i=0;i<7;i++) cout << ima[i];
    cout << endl;
    ima = num[n];
  }
  }
  return 0;



}