#include <bits/stdc++.h>
using namespace std;
string seg[10] = {"0111111", "0000110", "1011011", "1001111", "1100110",
                  "1101101", "1111101", "0100111", "1111111", "1101111"};
int in;
string now, ans;
void solve() {
  ans.clear();
  for (int i = 0; i < 7; i++) {
    if (now[i] != seg[in][i])
      ans += '1';
    else
      ans += '0';
  }
  ans += '\0';
  now = seg[in];
}
int main() {
  int n;
  while (true) {
    cin >> n;
    if (n == -1) return 0;
    for (int i = 0; i < n; i++) {
      cin >> in;
      if (i == 0) {
        now = seg[in];
        cout << now << endl;
        continue;
      }
      solve();
      cout << ans << endl;
    }
  }
}
