#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  string num[] = {"0111111", "0000110", "1011011", "1001111", "1100110",
                  "1101101", "1111101", "010011",  "111111",  "1101111"};
  while (cin >> n) {
    if (n == -1) break;
    string now = "0000000";
    for (int i = 0; i < (n); i++) {
      int a;
      cin >> a;
      for (int i = 0; i < (7); i++) {
        if (now[i] != num[a][i])
          cout << "1";
        else
          cout << "0";
      }
      cout << endl;
      now = num[a];
    }
  }
  return 0;
}
