w;x;y;main(a,b){for(;~scanf("%s %4c",&a,&b);b&16||(w=x=y=!puts("-1"+!(x^y))))(a&1?y=0,&w:&x)[b&2]^=!w;}
Note that non-ascii characters in the above source code will be escaped (such as \x9f).
download
return to the top page