#include<stdio.h>
int main(){
  char d[][8]={"0111111","0000110","1011011","1010000","1100110",
	      "1101101","1111101","0100111","1111111","1101111"};
  int n,m,i;
  while(scanf("%d",&n),n+1){
    char l[8]={"00000000"};
    while(n--){
      scanf("%d",&m);
      for(i=0;i<7;i++){
	if(l[i]==d[m][i])printf("0");
	else             printf("1");
	l[i]=d[m][i];
      }
      printf("\n");
    }
  }
  return 0;
}