#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<string> seg;
  int n, s, count = 0, ago;
  string a, b;
  seg.push_back("0111111");
  seg.push_back("0000110");
  seg.push_back("1011011");
  seg.push_back("1001111");
  seg.push_back("1100110");
  seg.push_back("1101101");
  seg.push_back("1111101");
  seg.push_back("0111111");
  seg.push_back("1111111");
  seg.push_back("1101111");
  while (cin >> n) {
    if (n < 0) return 0;
    for (int i = 0; i < n; i++) {
      cin >> s;
      if (count == 0) {
        cout << seg[s] << endl;
        count++;
        ago = s;
        continue;
      }
      a = seg[ago];
      b = seg[s];
      for (int j = 0; j < 7; j++) {
        if (a[j] == b[j])
          cout << '0';
        else
          cout << '1';
      }
      cout << endl;
      ago = s;
    }
    count = 0;
  }
}
