#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  string a[10];
  a[0] = "0111111";
  a[1] = "0000110";
  a[2] = "1011011";
  a[3] = "1001111";
  a[4] = "1100001";
  a[5] = "1101101";
  a[7] = "0100111";
  a[6] = "1111101";
  a[8] = "1111111";
  a[9] = "1101111";
  while (true) {
    long long n;
    cin >> n;
    if (n == -1) {
      break;
    }
    string s = "0000000";
    for (int i = 0; i < n; i++) {
      int d;
      cin >> d;
      for (int j = 0; j < 7; j++) {
        if (a[d][j] == s[j]) {
          cout << 0;
        } else {
          cout << 1;
        }
      }
      cout << endl;
      s = a[i];
    }
  }
  return 0;
}
