var s,t,u:string;a:byte;begin repeat readln(s);readln(t);str(s:3,t:3,u);a:=5;while u<>s[a..a+2]+t[a..a+2]do a:=a+4;writeln(a/4:-2:0,u)until 1=0end.