#include <iostream>
#include <vector>
#include <algorithm>
constexpr int DISPLAY[] = { 0b0111111, 0b0000110, 0b1011011, 0b1001111, 0b1100110, 0b1101101, 0b1111101, 0b0100111, 0b1111111, 0b1101111, 0 };
void show(int n) {
	for (int i = 6; i >= 0; --i) {
		std::cout << ((((1 << i) & n) == 0) ? 0 : 1);
	}
	std::cout << std::endl;
}
int main() {
	int n;
	int prev_state, d;
	std::cin >> n;
	while (n != -1) {
		prev_state = 10;
		for (auto i = 0; i < n; ++i) {
			std::cin >> d;
			show(DISPLAY[prev_state] ^ DISPLAY[d]);
			prev_state = d;
		}
		std::cin >> n;
	}

}
