#include <iostream>
using namespace std;
char tbl[] = {
  0x3f, 0x6, 0x5b, 0x4f, 0x66, 0x6d, 0x7d, 0x27, 0x7f, 0x6f,
};
int main()
{
  for(;;){
    int n;
    cin >> n;
    if(n < 0) break;
    int ans = 0;
    for(int i=0; i<n; i++){
      int j;
      cin >> j;
      ans ^= tbl[j];
      for(int k=0; k<7; k++){
        if((ans & (0x40 >> k)) == (0x40 >> k)) cout << 1;
        else cout << 0;
      }
      cout << endl;
      ans = tbl[j];
    }
  }
  return 0;
}