#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, s;
  string san[11];
  san[0] = "0111111";
  san[1] = "0000110";
  san[2] = "1011011";
  san[3] = "1001111";
  san[4] = "1100110";
  san[5] = "1101101";
  san[6] = "1111101";
  san[7] = "0100111";
  san[8] = "1111111";
  san[9] = "1101111";
  while (cin >> n) {
    if (n == -1) break;
    string mem;
    for (int i = 0; i < n; i++) {
      cin >> s;
      string a;
      if (i == 0) {
        cout << san[i] << endl;
        mem = san[i];
      } else {
        for (int i = 0; i < 7; i++) {
          if (san[s][i] == mem[i])
            a += '0';
          else
            a += '1';
        }
        cout << a << endl;
        mem = san[s];
      }
    }
  }
  return 0;
}
