#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<string> seg;
  int n, s;
  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 && n > 100) return 0;
    string start = "0000000", ans = "0000000";
    for (int i = 0; i < n; i++) {
      cin >> s;
      string result = seg[s];
      cout << "start:  " << start << endl;
      cout << "result: " << result << endl;
      for (int j = 0; j < 7; j++) {
        if (start[j] == result[j])
          ans[j] = '0';
        else
          ans[j] = '1';
      }
      cout << ans << endl;
      start = seg[s];
    }
  }
  return 0;
}
