#include <bits/stdc++.h>
using namespace std;
string hantei(int);
int main() {
  int n, in;
  while (1) {
    cin >> n;
    if (n == -1) break;
    string now = "0000000";
    for (int i = 0; i < n; i++) {
      cin >> in;
      string tmp = hantei(in);
      string out = "";
      bool hyouzi = false;
      for (int j = 0; j < 7; j++) {
        if (now[j] == tmp[j])
          out += '0';
        else {
          out += '1';
          hyouzi = true;
        }
      }
      if (hyouzi) cout << out << endl;
      now = tmp;
    }
  }
  return 0;
}
string hantei(int n) {
  if (n == 0) return "0111111";
  if (n == 1) return "0000110";
  if (n == 2) return "1011011";
  if (n == 3) return "1001111";
  if (n == 4) return "1100110";
  if (n == 5) return "1101101";
  if (n == 6) return "1111101";
  if (n == 7) return "0100111";
  if (n == 8) return "1111111";
  if (n == 9) return "1101111";
}
