#include <cstdio>
#include <iostream>
#include <bitset>
using namespace std;

int main()
{
  int seg[] = {0x3f, 0x6, 0x5b, 0x4f, 0x66, 0x6d, 0x7d, 0x27, 0x7f, 0x6f};
  int n;

  while (scanf("%d", &n), n != -1){
    int ans = 0;
    while (n--){
      int m;
      scanf("%d", &m);
      cout << bitset<7>(ans ^ seg[m]) << '\n';
      ans = seg[m];
    }
  }

  return (0);
}