#include<bits/stdc++.h>
using namespace std;
const int INF = 1 << 30;

bool lookup[][7] = {
  {1,1,1,1,1,1,0},
  {0,1,1,0,0,0,0},
  {1,1,0,1,1,0,1},
  {1,1,1,1,0,0,1},
  {0,1,1,0,0,1,1},
  {1,0,1,1,0,1,1},
  {1,0,1,1,1,1,1},
  {1,1,1,0,0,1,0},
  {1,1,1,1,1,1,1},
  {1,1,1,1,0,1,1}
};
int main()
{
  int n;
  while(cin >> n, ~n) {
    bool display[7] = {};
    while(n--) {
      int digit;
      cin >> digit;
      for(int i = 6; i >= 0; i--) {
        cout << (lookup[digit][i] ^ display[i]);
        display[i] = lookup[digit][i];
      }
      cout << endl;
    } 
  }
}