#include <stdio.h>

int main(void)
{
	int table[10] = {0x3f, 0x6, 0x5b, 0x4f, 0x66, 0x6d, 0x7d, 0x27, 0x7f, 0x6f};
	int n;
	int number;
	unsigned int data;
	
	while (1){
		data = 0;
		
		scanf("%d", &n);
		if (n == -1){
			break;
		}
		for (int i = 0; i < n; i++){
			unsigned int ans;
			scanf("%d", &number);
			
			ans = table[number] ^ data;
			for (int i = 0; i < 7; i++){
				printf("%d", ((ans >> (6 - i)) & 1));
			}
			data = table[number];
			
			puts("");
		}
	}
	
	return (0);
}