#include<iostream>
#include<string>
#include<vector>
#include<utility>
#include<queue>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<complex>
#define INF 2147483647
#define llINF 9223372036854775807
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long

using namespace std;
int main(){
  int n;
  while(cin>>n,n>=0){
    string num[10]={"0111111","0000110","1011011","1001111","1100110","1101101","1111101","0100111","1111111","1101111"};
    string nows="0000000";
    for(int i=0;i<n;i++){
      int d;cin>>d;
      for(int j=0;j<7;j++){
	if(num[d][j]!=nows[j]){
	  cout<<1;
	}else
	  cout<<0;
      }
      cout<<endl;
      nows=num[d];
    }
  }
  return 0;
}

