#include <bits/stdc++.h>
using namespace std;
int n, m;
vector<int> vege;
const int INF = 1 << 29;
int main(void) {
  int memo[] = {127 - 64,
                6,
                64 + 16 + 8 + 2 + 1,
                64 + 15,
                64 + 32 + 4 + 2,
                64 + 32 + 8 + 4 + 1,
                127 - 2,
                32 + 7,
                127,
                127 - 16};
  int nisin[] = {64, 32, 16, 8, 4, 2, 1};
  while (cin >> n && n != -1) {
    int bit = 0;
    for (int i = 0; i < n; i++) {
      int a;
      cin >> a;
      int ans = bit ^ memo[a];
      bit = memo[a];
      for (int j = 0; j < 7; j++) {
        if (ans > nisin[j]) {
          ans -= nisin[j];
          cout << 1;
        } else
          cout << 0;
      }
      cout << endl;
    }
  }
  return 0;
}
