#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;

int n;
string now;
string digit[10] = {
  "0111111",
  "0000110",
  "1011011",
  "1001111",
  "1100110",
  "1101101",
  "1111101",
  "0100111",
  "1111111",
  "1101111"
};

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  while (cin >> n, n >= 0) {
    now = "0000000";
    for (int i = 0; i < n; i++) {
      string ans(7, '0');
      int d;
      cin >> d;
      for (int j = 0; j < 7; j++) {
        if (now[j] == digit[d][j]) continue;
        ans[j] = '1';
      }
      cout << ans << endl;
      now = digit[d];
    }
  }  

  return 0;
}
