#include <iostream>
#include <vector>
#include <bitset>
using namespace std;

int main() {
  vector<int> bs = {0x0, 0x3f, 0x6, 0x5b, 0x4f, 0x66, 0x6d, 0x7d, 0x27, 0x7f, 0x6f}; // two based
  int n;
  while(cin >> n, n >= 0) {
    int lastnum = -1;
    for(int i = 0; i < n; ++i) {
      int num;
      cin >> num;
      cout << static_cast<bitset<7> >(bs[num + 1] ^ bs[lastnum + 1]) << endl;
      lastnum = num;
    }
  }
  return 0;
}