#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
#define REP(i,b,n) for(int i=b;i<n;i++)
#define rep(i,n)   REP(i,0,n)
#define ALL(c)   (c).begin(),(c).end()
#define pb push_back
string a[10]={
  "1111110",
  "0110000",
  "1101101",
  "1111001",
  "0110011",
  "1011011",
  "1011111",
  "1110010",
  "1111111",
  "1111011"
};

int main(){
  rep(i,10)reverse(ALL(a[i]));
  int n;
  while(cin>>n && n != -1){
    int last=0;
    string op="0000000";
    rep(tc,n){
      int now;
      string tmp;
      cin>>now;
      rep(i,op.size()){
	if(op[i] != a[now][i]){
	  tmp+="1";
	}else tmp+="0";
      }
      cout << tmp << endl;
      op=a[now];
    }

  }
  return false;
}