#include<bits/stdc++.h>
using namespace std;
#define ll long long 
int main(){
   while(1){
      int n;
      cin >> n;
      if(n==-1){
         break;
      }
      vector<int> seg = {0b0111111,0b0000110,0b1011011,0b1001111,0b1100110,0b1101101,0b1111101,0b0100111,0b1111111,0b1101111};
      vector<int> vec(n+1);
      vec[0] = 0b0000000;
      for(int i=1;i<n+1;i++){
         cin >> vec[i];
         vec[i] = seg[vec[i]];
      }
      for(int i=0;i<n;i++){
         cout << bitset<7>(vec[i]^vec[i+1]) << endl;
      }
   }

}
