#include <iostream>
using namespace std;
int main (){
  int  d[10][7] ={{0,1,1,1,1,1,1},
		  {0,0,0,0,1,1,0},
		  {1,0,1,1,0,1,1},
		  {1,0,0,1,1,1,1},
		  {1,1,0,0,1,1,0},
		  {1,1,0,1,1,0,1},
		  {1,1,1,1,1,0,1},
		  {0,1,0,0,1,1,1},
		  {1,1,1,1,1,1,1},
		  {1,1,0,1,1,1,1}};

  int n;
  while(cin>>n && n!=-1){
    int  s[7] = {0,0,0,0,0,0,0};
    for(int i=0;i<n;i++){
      int a;
      cin >>a;
      for(int j=0;j<7;j++){
	if(s[j]!=d[a][j]){
	  cout<<1;
	  s[j]=d[a][j];
	}
	else cout <<0;
      }
      cout <<endl;
    }
  }
  return 0;
}