#include <bits/stdc++.h>
using namespace std;
string str[] = {"0111111", "0000110", "10111011", "1001111", "1100110",
                "1101101", "1111101", "01001111", "1111111", "1101111"};
int main() {
  int n;
  while (1) {
    string s = "";
    cin >> n;
    if (n == -1) break;
    for (int i = 0; i < n; i++) {
      int num;
      cin >> num;
      if (i == 0)
        cout << str[num] << endl;
      else {
        string tmp = "";
        for (int i = 0; i < 7; i++) {
          if (str[num][i] != s[i])
            tmp += "1";
          else
            tmp += "0";
        }
        cout << tmp << endl;
      }
      s = str[num];
    }
  }
  return 0;
}
