#include <bits/stdc++.h>
using namespace std;
int main() {
  int m[10][7];
  for (int i = 0; i < 10; i++)
    for (int j = 0; j < 7; j++) m[i][j] = 1;
  m[0][6] = 0, m[1][0] = 0, m[1][3] = 0, m[1][4] = 0, m[1][5] = 0, m[1][6] = 0,
  m[2][2] = 0, m[2][5] = 0, m[3][4] = 0, m[3][5] = 0, m[4][0] = 0, m[4][3] = 0,
  m[4][4] = 0, m[5][1] = 0, m[5][4] = 0, m[6][1] = 0, m[7][3] = 0, m[7][4] = 0,
  m[7][6] = 0, m[9][4] = 0;
  int n, a, set;
  while (true) {
    cin >> n;
    if (n == -1) break;
    cin >> set;
    for (int i = 6; i >= 0; i--) cout << m[set][i];
    cout << endl;
    for (int i = 1; i < n; i++) {
      cin >> a;
      for (int i = 6; i >= 0; i--) cout << abs(m[set][i] - m[a][i]);
      cout << endl;
      set = a;
    }
  }
  return 0;
}
