s=input() win="NA" if "OOO" in s and "XXX" in s: a=s.index("OOO") b=s.index("XXX") if a