#include <iostream>
#include <string>

using namespace std;

int main()
{
  int n, m;
  string s1, s2;

  while(1){
    cin >> n;
    if(n == -1){
      break;
    }

    s1 = "0000000";
    while(n--){
      cin >> m;
      if(m == 0){
	s2 = "0111111";
      } else if(m == 1){
	s2 = "0000110";
      } else if(m == 2){
	s2 = "1011011";
      } else if(m == 3){
	s2 = "1001111";
      } else if(m == 4){
	s2 = "1100110";
      } else if(m == 5){
	s2 = "1101101";
      } else if(m == 6){
	s2 = "1111101";
      } else if(m == 7){
	s2 = "0100111";
      } else if(m == 8){
	s2 = "1111111";
      } else {
	s2 = "1101111";
      }
      for(int i = 0; i < 7; i++){
	if(s1[i] == s2[i]){
	  cout << 0;
	} else {
	  cout << 1;
	}
      }
      cout << endl;
      s1 = s2;
    }

  }

  return 0;
}