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

int main() {
  int n;
  int num;
  string now, next;
  static string data[10] = {"0111111","0000110","1011011","1001111","1100110",
			    "1101101","1111101","0100111","1111111","1101111"};
  while(1) {
    cin >> n;
    if(n == -1) break;
    now = "0000000";
    for(int i = 0; i < n; i++) {
      cin >> num;
      for(int i = 0; i < 7; i++) {
	if(now[i] == data[num][i]) {
	  cout << "0";
	} else {
	  cout << "1";
	}
      }
      now = data[num];
      cout << endl;
    }
  }
  return 0;
}