#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int i, j;
  int n;
  while (1) {
    cin >> n;
    if (n < 0) break;
    char s[10][10] = {"0111111", "0000110", "1011011", "1001111", "1100110",
                      "1101101", "1111101", "0100111", "1111111", "1101111"};
    int d;
    cin >> d;
    cout << s[d] << endl;
    int b = d;
    for (i = 0; i < n - 1; i++) {
      cin >> d;
      for (j = 0; j < 7; j++)
        if (s[b][j] == s[d][j])
          cout << "0";
        else
          cout << "1";
      cout << endl;
    }
  }
}
