#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, s;
  string seg[10] = {"0111111", "0000110", "1011011", "1001111", "1100110",
                    "1101101", "1111101", "0111111", "1111111", "1101111"};
  while (cin >> n) {
    if (n < 0) return 0;
    string start = "0000000", ans = "0000000";
    for (int i = 0; i < n; i++) {
      cin >> s;
      string result = seg[s];
      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];
    }
  }
}
