#include <bits/stdc++.h>
using namespace std;
int main(void) {
  string state[10];
  int n;
  state[0] = "0111111";
  state[1] = "0000110";
  state[2] = "1011011";
  state[3] = "1001111";
  state[4] = "1100110";
  state[5] = "1101101";
  state[6] = "1111101";
  state[7] = "0000111";
  state[8] = "1111111";
  state[9] = "1101111";
  while (cin >> n && n != -1) {
    string cur = "0000000";
    string out = "0000000";
    int t;
    for (int i = 0; i < n; i++) {
      cin >> t;
      for (int i = 0; i < 7; i++) {
        cur[i] == state[t][i] ? out[i] = '0' : out[i] = '1';
      }
      cout << out << endl;
      cur = state[t];
    }
  }
}
