#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
const int MOD = 1e9 + 7;
signed main() {
  string s[] = {"0111111", "0000110", "1011011", "1001111", "1100110",
                "1101101", "1111101", "0100111", "1111111", "1101111"};
  string state = "0000000";
  for (int n; cin >> n && n != -1;) {
    for (int i = (0); i < (n); i++) {
      int a;
      cin >> a;
      string ans = "";
      for (int i = (0); i < (7); i++) {
        if (s[a][i] == state[i])
          ans += "0";
        else
          ans += "1";
      }
      cout << ans << endl;
      state = s[a];
    }
  }
  return 0;
}
