#include <iostream>
#include <vector>

using namespace std;

int main() {
    int n, k;
    char out[10][8] = {"0111111","0000110","1011011","1001111","1100110","1101101","1111101","0100111","1111111","1101111"};
    char bit[8];
    while (cin >> n, n != -1) {
          for (int i = 0; i < 7; ++i) bit[i] = '0';
          bit[7] = '\0';
          for (int i = 0; i < n; ++i) {
              cin >> k;
              for (int j = 0; j < 7; ++j) {
                  if (out[k][j] != bit[j]) {
                     cout << 1;
                     bit[j] = (bit[j] == '0' ? '1' : '0');
                  }
                  else cout << 0;
              }
              cout << endl;
          }
    }
    return 0;
}