#include <iostream>
#include <algorithm>
using namespace std;

int main(){
  int N;
  int prev[7];
  char temp[10][8] = {"0111111","0000110","1011011","1001111","1100110","1101101","1111101","0100111","1111111","1101111"};
  while(cin >> N,N>=0){
    fill(prev,prev+7,0);
    while(N--){
      int ans[7],n,fig[7];
      cin >> n;
      for(int i=0;i<7;i++){
	if(temp[n][i] -'0' != prev[i]) ans[i] = 1;
	else ans[i] = 0;
      }
      for(int i=0;i<7;i++) fig[i] = temp[n][i]-'0';
      for(int i=0;i<7;i++) cout << ans[i];
      cout << endl;
      copy(fig,fig+7,prev);
    }
  }
}