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

vector<string> l = {
  "0111111",
  "0000110",
  "1011011",
  "1001111",
  "1100110",
  "1101101",
  "1111101",
  "0100111",
  "1111111",
  "1101111",
  "0000000"
};

string change(int now ,int nxt){
  string s = "";
  for(int i=0;i<l[now].size();i++){
    if(l[now][i]!=l[nxt][i]){
      s += '1';
    }else{
      s+='0';
    }
  }
  return s;
}

int solve(){
  int now = 10;
  int n = 0;
  cin>>n;
  if(n==-1)return false;
  for(int i=0;i<n;i++){
    int tmp;
    cin>>tmp;
    cout<<change(now,tmp)<<endl;
    now = tmp;
  }
  return 1;
}

int main(){
  while(solve());
}