#include<iostream>
#include<string>
using namespace std;
int main()
{
	string num[] = { "0111111", "0000110", "1011011", "1001111",
		"1100110", "1101101", "1111101", "0100111",
		"1111111", "1101111", "1000110" };
	int n,a;
	string s,t;
	while (true){
		cin >> n;
		if (n == -1){
			break;
		}
		cin >> a;
		s = num[a];
		cout << s << endl;
		for (int i = 0; i < n - 1; i++){
			cin >> a;
			for (int i2 = 0; i2 < num[a].size(); i2++){
				if (s[i2] != num[a][i2]){
					t += '1';
				}
				else{
					t += '0';
				}
			}
			cout << t << endl;
			s = num[a];
			t.clear();
		}
	}
}