using System; using System.Collections.Generic; using System.Linq; class Program { static void Main(string[] args) { string S = Console.ReadLine(); int east = S.IndexOf("OOO"); int west = S.IndexOf("XXX"); if (0 <= west && (west < east || east < 0)) { Console.WriteLine("West"); } else if (0 <= east && (east < west || west < 0)) { Console.WriteLine("East"); } else { Console.WriteLine("NA"); } } }