using namespace std;

string s[10] = {
  "0111111",
  "0000110",
  "1011011",
  "1001111",
  "1100110",
  "1101101",
  "1111101",
  "0100111",
  "1111111",
  "1101111",
};


int main(void){
  int n;
  while(cin>>n, (n!=-1)){
    string now = "0000000";
    for(int i=0;i<n;i++){
      int x;
      cin>>x;
      string change = "0000000";
      for(int i=0;i<7;i++){
        if(s[x][i] != now[i]){
          change[i] = '1';
        }
      }
      cout<<change<<endl;
      now = s[x];
    }
  }

  return 0;
}