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

int main(){
  int i,j,n,be,af;
  string a[10],ans;
  a[0] = "0111111";
  a[1] = "0000110";
  a[2] = "1011011";
  a[3] = "1001111";
  a[4] = "1100110";
  a[5] = "1101101";
  a[6] = "1111101";
  a[7] = "0100111";
  a[8] = "1111111";
  a[9] = "1101111";
  while(1){
    cin >> n;
    if(n == -1) break;
    for(i=0;i<n;i++){
      cin >> af;
      if(i == 0){
	ans = a[af];
      }
      else{
	for(j=0;j<7;j++){
	  if(a[af][j] == a[be][j]) ans[j] = '0';
	  else ans[j] = '1';
	}
      }
      cout << ans << endl;
      be = af;
    }
  }
  return 0;
}