#include<iostream>
#include<algorithm>
using namespace std;
int main(){
  int n,l[101][101],m;
  fill(l[0],l[0]+101,0);
  while(cin >> n,n+1){
    for(int i = 1;i <= n;i++){
      cin >> m;
      if(m>1&&m!=7) l[i][0] = 1;
      else l[i][0] = 0;
      if(m<4&&m>0) l[i][1] = 0;
      else l[i][1] = 1;
      if(m%2==0&&m!=4) l[i][2] = 1;
      else l[i][2] = 0;
      if(m==1||m==4||m==7) l[i][3] = 0;
      else l[i][3] = 1;
      if(m==2) l[i][4] = 0;
      else l[i][4] = 1;
      if(m==5||m==6) l[i][5] = 0;
      else l[i][5] = 1;
      if(m==1||m==4) l[i][6] = 0;
      else l[i][6] = 1;
      for(int j = 0;j <= 6;j++){
	if(l[i][j] == l[i-1][j]) cout << 0;
	else cout << 1;
      }
      cout << endl;
    }
  }
  return (0);
}