#include <bits/stdc++.h>
using namespace std;
int main() {
  string table[] = {"0111111", "0000110", "1011011", "1001111", "1100110",
                    "1101101", "1111101", "1111111", "1101111"};
  int n;
  while (cin >> n, ~n) {
    string cur = "0000000";
    for (int i = 0; i < n; i++) {
      int number;
      cin >> number;
      for (int i = 0; i < 7; i++) cout << (cur[i] != table[number][i]);
      cout << endl;
      cur = table[number];
    }
  }
}
