#include <iostream>

using namespace std;

int main(void){
  int ans[10][7] =  {
    {0,1,1,1,1,1,1},  //0
    {0,0,0,0,1,1,0},  //1
    {1,0,1,1,0,1,1},  //2
    {1,0,0,1,1,1,1},  //3
    {1,1,0,0,1,1,0},  //4
    {1,1,0,1,1,0,1},  //5
    {1,1,1,1,1,0,1},  //6
    {0,1,0,0,1,1,1},  //7
    {1,1,1,1,1,1,1},  //8
    {1,1,0,1,1,1,1},  //9
  };
  int n;
  while(cin>>n,n>0){
    int number;
    int now[7]={0,0,0,0,0,0};
    for(int j = 0 ; j < n ; j ++){
      cin>>number;
      for(int i = 0 ; i < 7 ; i ++){
        cout<<(ans[number][i]==now[i]?0:1);
        now[i]=ans[number][i];
      }
      cout<<endl;
    }
  }
}