#include <bits/stdc++.h>
constexpr int DISPLAY[] = {0b0111111, 0b0000110, 0b1011011, 0b1001111,
                           0b1100110, 0b1101101, 0b1111101, 0b0100111,
                           0b1111111, 0b1101111};
void show(int n) {
  for (int i = 6; i >= 0; --i) {
    std::cout << ((((1 << i) & n) == 0) ? 0 : 1);
  }
  std::cout << std::endl;
}
int main() {
  int n;
  int prev_state, d;
  std::cin >> n;
  while (n != -1) {
    prev_state = 0;
    for (auto i = 0; i < n; ++i) {
      std::cin >> d;
      prev_state ^= DISPLAY[d];
      show(prev_state);
    }
    std::cin >> n;
  }
}
