#include <iostream>
#include <string>

using namespace std;

int main() {
  string signals[] = {
    "0111111",
    "0000110",
    "1011011",
    "1001111",
    "1100110",
    "1101101",
    "1111101",
    "0100111",
    "1111111",
    "1101111"
  };
  while (true) {
    int n, k;
    string cur(7, '0');
    cin >> n;
    if (n < 0) {
      return 0;
    }
    for (int i = 0; i < n; ++i) {
      cin >> k;
      for (int j = 0; j < 7; ++j) {
        cout << (cur[j] == signals[k][j]? '0': '1');
      }
      cout << endl;
      cur = signals[k];
    }
  }
}