#include <bits/stdc++.h>
using namespace std;
int main() {
  unsigned long num[11] = {63, 6, 91, 79, 66, 109, 125, 39, 127, 111, 0};
  int n, a, b = 10;
  while (cin >> n, n != -1) {
    bitset<7> now((unsigned long)0);
    b = 10;
    for (int i = 0; i < n; i++) {
      cin >> a;
      now = num[b] ^ num[a];
      for (int i = 6; i >= 0; i--) {
        cout << now[i];
      }
      cout << endl;
      b = a;
    }
  }
}
