//22
#include<iostream>

using namespace std;

int main(){
  for(int n;cin>>n,n!=-1;){
    int lcd[7]={};
    while(n--){
      int nm;
      cin>>nm;
      for(int i=6;i>=0;i--){
	static const int on[][7]={{1,1,1,1,1,1,0},{0,1,1,0,0,0,0},{1,1,0,1,1,0,1},{1,1,1,1,0,0,1},{0,1,1,0,0,1,1},{1,0,1,1,0,1,1},{1,0,1,1,1,1,1},{1,1,1,0,0,1,0},{1,1,1,1,1,1,1},{1,1,1,1,0,1,1}};
	cout<<(lcd[i]^on[nm][i]);
	lcd[i]=on[nm][i];
      }
      cout<<endl;
    }
  }
  return 0;
}