import"io"for Stdin while(1){ var s=Stdin.readLine() System.print(s[s[1]!=s[2]?4:2])}