#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  char num[10][8] = {{"0111111"}, {"0000110"}, {"1011011"}, {"1001111"},
                     {"1001111"}, {"1101101"}, {"1111101"}, {"1111101"},
                     {"1111111"}, {"1101111"}};
  while (cin >> n, n != -1) {
    char display[8] = {"0000000"};
    while (n--) {
      int inp;
      cin >> inp;
      for (int i = (0); i < (7); i++) {
        if (display[i] == num[inp][i]) {
          cout << '0';
        } else {
          cout << '1';
        }
      }
      cout << endl;
      strcpy(display, num[inp]);
    }
  }
}
