#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>

using namespace std;

const string num[10] ={
  "0111111", "0000110", "1011011", "1001111", "1100110", "1101101", "1111101",
  "0100111", "1111111", "1101111"};

int main() {
  int N, n;
  
  while(cin >> n){
    if(n == -1) break;
    string now, after;
    
    for(int cs = 0 ; cs < n ; cs++){
      cin >> N;
      
      if(cs == 0){
	cout << num[N] << endl;
	now = num[N];
      }
      else{
	after = num[N];
	for(int i = 0 ; i < 7 ; i++){
	  if(now[i] == after[i]) cout << '0';
	  else cout << '1';
	}
	cout << endl;
	now = after;
      }
    }
  }
  return 0;
}