#include <bits/stdc++.h>
void binarywrite(int n) {
  for (int i = 6; i >= 0; i--) {
    printf("%d", (n >> i & 1));
  }
  puts("");
}
int main() {
  unsigned long long int lighta = 0x3f065b4f66, lightb = 0x6d7d277f6f;
  int n = 0;
  while (scanf("%d", &n), ~n) {
    int prev_j = 0;
    for (int i = n; i; i--) {
      int j;
      scanf("%d", &j);
      binarywrite(prev_j ^ (j < 5 ? lighta >> (4 - j) * 8 & 0xff
                                  : lightb >> (9 - j) * 8 & 0xff));
      prev_j =
          (j < 5 ? lighta >> (4 - j) * 8 & 0xff : lightb >> (9 - j) * 8 & 0xff);
    }
  }
  return 0;
}
