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

string diff(string now,string bit)
{
  string ans="0000000";
  for(int i=0;i<7;i++){
    //  cout<<(now[i]-'0')<<endl;
   // cout<<(bit[i]-'0')<<endl; 
   // cout<<((now[i]-'0') ^ (bit[i]-'0'))<<endl; 
    ans[i]=((now[i]-'0') ^ (bit[i]-'0'))+'0'; 
  }  
  return ans;
}

int main()
{
  string bit[10]={
    "1111110",
    "0110000",
    "1101101",
    "1111001",
    "0110011",
    "1011011",
    "1011111",
    "1110010",
    "1111111",
    "1111011"
  };
  
  int n;
  for(;cin>>n,n!=-1;)
    {
      string now="00000000";
      for(int i=0;i<n;i++)
	{
	  int tar;
	  cin>>tar;
	  string s=diff(now,bit[tar]);
	  reverse(s.begin(), s.end());
	  cout<<s<<endl;
	  now=bit[tar];
	}
    }

}