#include<iostream>
using namespace std;

int main(){
  bool seg[11][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},
		    {0,0,0,0,0,0,0} };
  int n,prv,tmp;

  while(1){
    cin >> n;
    if(n<0)break;

    prv = 10;
    for(int i=0;i<n;i++){
      cin >> tmp;
      for(int j=0;j<7;j++){
	if(seg[prv][j] == seg[tmp][j])cout << 0;
	else cout << 1;
      }
      cout << endl;
      prv = tmp;
    }
  }
}