var a,b,c:char="1";begin repeat readln(a,b);c:=(b+c+a)[2-ord(c=a)+ord(c=b)];writeln(c)until 0>0end.