#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
using namespace std;
using ll = long long;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  vector<int> segments = {0b0111111, 0b0000110, 0b1011011, 0b1001111,
                          0b1100110, 0b1101101, 0b1111101, 0b0100111,
                          0b1111111, 0b1101111};

  while(1) {
    int n;
    cin >> n;
    if(n == -1) { break; }
    int bef, aft;
    cin >> bef;
    cout << bitset<7>(segments[bef]) << endl;
    for(int i = 0; i < n - 1; i++) {
      cin >> aft;
      cout << bitset<7>(segments[bef] ^ segments[aft]) << endl;
      bef = aft;
    }
  }
  return 0;
}
