#include<iostream>
#include<cstdio>


using namespace std;

string bit[12] = {
  "0111111", /*0*/
  "0000110", /*1*/
  "1011011", /*2*/
  "1001111", /*3*/
  "1100110", /*4*/
  "1101101", /*5*/
  "1111101", /*6*/
  "0100111", /*7*/ 
  "1111111", /*8*/
  "1101111", /*9*/
  "0000000"  /*pre*/
};





int main(){
  int n,in;
  while(true){
    cin >> n;
    if(n == -1)break;
    int pre = 10;
    for(int i=0;i<n;i++){   
      cin >> in;
      for(int i=0;i<7;i++){
	if(bit[pre][i] != bit[in][i]){
	  cout << '1';
	}
	else cout << '0';
      }
      cout << endl;
      pre = in;
    }
  }
  return 0;
}