#include <bits/stdc++.h>
using namespace std;
int main() {
  while (1) {
    int n, num, j = 0;
    string sig = "0000000", str;
    cin >> n;
    if (n == -1) break;
    for (int k = 0; k < n; k++) {
      cin >> num;
      string ans = "";
      if (num == 0)
        str = "0111111";
      else if (num == 1)
        str = "0000110";
      else if (num == 2)
        str = "1011011";
      else if (num == 3)
        str = "1001111";
      else if (num == 4)
        str = "1101101";
      else if (num == 5)
        str = "1101101";
      else if (num == 6)
        str = "1111101";
      else if (num == 7)
        str = "0100111";
      else if (num == 8)
        str = "1111111";
      else
        str = "1101111";
      for (int i = 0; i < 7; i++) {
        if (sig.at(i) != str.at(i))
          ans += '1';
        else
          ans += '0';
      }
      sig = str;
      cout << ans << endl;
    }
  }
  return 0;
}
