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

int main(){

  int b[11] = {63,6,91,79,102,109,125,39,127,111,0};
  int now = 11;
  int k;
  int n;

  while(cin >> n){
    if(n == -1) break;
    
    cin >> k;
    for(int i=6;i>-1;i--) printf("%d", (b[k]>>i)&1);
    now = k;
    cout << endl;
    n--;
    
    while(n--){
      cin >> k;
      int p = (b[now]^b[k]);
      for(int i=6;i>-1;i--) printf("%d", (p>>i)&1);
      printf( "\n" );
      now = k;
    }
  }

}