#include <iostream>
using namespace std;

int num[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 main(){

  int n;
  while(1){
    cin >> n;
    if(n==-1) break;
    int pre =10,next;
    for(int i=0;i<n;i++){
      cin  >> next;
      for(int j=0;j<7;j++){
	if(num[pre][j] != num[next][j]) cout << "1";
	else cout << "0";
      }
      pre = next;
      cout << "\n";
    }

  }

}