#include <bits/stdc++.h>
using namespace std;
int main() {
  const int seg[] = {0x3f, 0x6, 0xb, 0x4f, 0x66, 0x6d, 0x7d, 0x27, 0x7f, 0x6f};
  int n;
  while (cin >> n, n != -1) {
    int res = 0;
    int num;
    for (int i = 0; i < n; i++) {
      cin >> num;
      cout << bitset<7>(res ^ seg[num]) << endl;
      res = seg[num];
    }
  }
  return (0);
}
