#include <bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
using namespace std;
int main(){
  string s[10]={"0111111","0000110","1011011","1001111","1100110","1101101","1111101","0100111","1111111","1101111"};
int n,a;
while(cin>>n,n>-1){
  string b="00000000";
  while(n--){
    cin>>a;
    r(i,7){
      if(b[i]!=s[a][i]){
        cout<<1;
      }
      else cout<<0;
      b[i]=s[a][i];
    }
    cout<<endl;
  }
}
}