import std.stdio;

void binarywrite(int n){
	for(int i=6;i>=0;i--){
		write(n >> i & 1);
	}
	writeln("");
}

int main(){
	long lighta = 0x3f065b4f66, lightb = 0x6d7d277f6f;
	int n = 0;
	while(readf("%d\n", &n), ~n){
		int prev_j = 0;
		for(int i=n;i;i--){
			int j;
			readf("%d\n", &j);
			binarywrite(prev_j ^ (j<5?lighta>>(4-j)*8&0xff:lightb>>(9-j)*8&0xff));
			prev_j = (j<5?lighta>>(4-j)*8&0xff:lightb>>(9-j)*8&0xff);
		}
	}
	return 0;
}