#include <bits/stdc++.h>
using namespace std;
int main() {
  string date[11], now;
  date[0] = "1111110";
  date[1] = "0110000";
  date[2] = "0110000";
  date[3] = "1111001";
  date[4] = "0110011";
  date[5] = "1011011";
  date[6] = "1011111";
  date[7] = "1110010";
  date[8] = "1111111";
  date[9] = "1111011";
  int n, kazu;
  while (1) {
    now = "0000000";
    cin >> n;
    if (n == -1) goto a;
    for (int i = 1; i <= n; i++) {
      cin >> kazu;
      for (int z = 6; z >= 0; z--) {
        if (date[kazu][z] == now[z]) {
          cout << 0;
        } else {
          cout << 1;
          if (now[z] == '0') {
            now[z] = '1';
          } else {
            now[z] = '0';
          }
        }
      }
      cout << endl;
    }
  }
a:;
}
