#include<iostream>
#include<string>
using namespace std;
int main() {
	int n;
	string b[10] = { "0111111","0000110","1011011","1001111",
	"1100110","1101101","1111101","0100111","1111111","1101111" };
	while (cin >> n&&n != -1) {
		string c = "0000000";
		for (int z = 0; z < n; z++) {
			int a;
			cin >> a;
			string d = "";
			for (int i = 0; i < 7; i++) {
				if (b[a][i] != c[i])
					d += "1";
				else
					d += "0";
			}																																									
			c = b[a];
			cout << d << endl;
		}
	}
}