#include <bits/stdc++.h>
using namespace std;

int main()
{
  string data[10] = {"0111111", "0000110", "1011011", "1001111", "1100110", "1101101", "1111101", "0100111", "1111111", "1101111"};
  int n;

  while( cin >> n, n != -1 ) {
    string now = "0000000";

    while( n-- ) {
      int num;
      string next = "0000000";

      cin >> num;
      for(int i=0; i<7; i++) {
	if( data[num][i] != now[i] ) next[i] = '1';
      }

      cout << next << endl;
      now = data[num];
    }
  }

  return 0;
}