#include <bits/stdc++.h>
using namespace std;
int main() {
  string s[10] = {"0111111", "0000110", "1011011", "1001111", "1100110",
                  "1101101", "1111101", "0100111", "1111111", "1101111"};
  int n, a;
  while (cin >> n, n < 0) {
    string b = "00000000";
    while (n--) {
      cin >> a;
      for (int i = 0; i < 7; i++) {
        if (b[i] != s[a][i]) {
          cout << 1;
        } else
          cout << 0;
        b[i] = s[a][i];
      }
      cout << endl;
    }
  }
}
