description: You had n positive integers a_1, a_2, ..., a_n arranged in a circle. For each pair of neighboring numbers (a_1 and a_2, a_2 and a_3, ..., a_{n - 1} and a_n, and a_n and a_1), you wrote down: are the numbers in the pair equal or not.
  
  Unfortunately, you've lost a piece of paper with the array a. Moreover, you are afraid that even information about equality of neighboring elements may be inconsistent. So, you are wondering: is there any array a which is consistent with information you have about equality or non-equality of corresponding pairs?
  
  Input
  
  The first line contains a single integer t (1 ≤ t ≤ 1000) — the number of test cases. Next t cases follow.
  
  The first and only line of each test case contains a non-empty string s consisting of characters E and/or N. The length of s is equal to the size of array n and 2 ≤ n ≤ 50. For each i from 1 to n: 
  
    * if s_i = E then a_i is equal to a_{i + 1} (a_n = a_1 for i = n); 
    * if s_i = N then a_i is not equal to a_{i + 1} (a_n ≠ a_1 for i = n). 
  
  Output
  
  For each test case, print YES if it's possible to choose array a that are consistent with information from s you know. Otherwise, print NO.
  
  It can be proved, that if there exists some array a, then there exists an array a of positive integers with values less or equal to 10^9.
  
  Example
  
  Input
  
  
  4
  EEE
  EN
  ENNEENE
  NENN
  
  
  Output
  
  
  YES
  NO
  YES
  YES
  
  Note
  
  In the first test case, you can choose, for example, a_1 = a_2 = a_3 = 5.
  
  In the second test case, there is no array a, since, according to s_1, a_1 is equal to a_2, but, according to s_2, a_2 is not equal to a_1.
  
  In the third test case, you can, for example, choose array a = [20, 20, 4, 50, 50, 50, 20].
  
  In the fourth test case, you can, for example, choose a = [1, 3, 3, 7].
solution: import java.util.*;
  import java.util.regex.Pattern;
  
  import javax.lang.model.element.Element;
  import javax.sql.rowset.spi.SyncResolver;
  
  import java.io.*;
  import java.nio.file.attribute.GroupPrincipal;
  import java.sql.PseudoColumnUsage;
  
  public class Solution {
  
      static FastReader fr = new FastReader();
      static final Random random = new Random();
      static long mod = 1000000007L;
      static HashSet<Long> notPrime = new HashSet<Long>();
      static HashSet<Long> Tprime = new HashSet<Long>();
      static boolean runonce = false;
      static int pieces = 0;
      static int[] dp;
      
      public static void main(String args[]) throws IOException {
          int t = fr.nextInt();
          while(t-->0)
          {
              String s = fr.nextLine();
  
              int length = s.length();
              if(length ==2)
              {
                  if(s.charAt(0)!= s.charAt(1))
                  {
                      System.out.println("NO");
                      
                  }
                  else
                  {
                      System.out.println("YES");
  
                  }
                  continue;
              }
              int ecount =0;
              for(int i=0;i<length;i++)
              {
                  if(s.charAt(i)=='E')
                  ecount++;
              }
              if(ecount==length-1 )
              {
                  System.out.println("NO");
              }
              else
              System.out.println("YES");
  
          }
         
          
  
          
      }
  
      static void printArray(Double[] a) {
          System.out.println();
          for (int i = 0; i < a.length; i++) {
  
              System.out.println(i+1+"- "+a[i] );
              // System.out.println();
          }
          System.out.println();
      }
  
      static int max(int a, int b) {
          if (a < b)
              return b;
          return a;
      }
  
      static void ruffleSort(int[] a) {
          int n = a.length;
          for (int i = 0; i < n; i++) {
              int oi = random.nextInt(n), temp = a[oi];
              a[oi] = a[i];
              a[i] = temp;
          }
          Arrays.sort(a);
      }
  
      static <E> void print(E res) {
          System.out.println(res);
      }
  
      static int gcd(int a, int b) {
          if (b == 0) {
              return a;
          }
          return gcd(b, a % b);
      }
  
      static int lcm(int a, int b) {
          return (a / gcd(a, b)) * b;
      }
  
      static int abs(int a) {
          if (a < 0)
              return -1 * a;
          return a;
      }
  
      static class FastReader {
          BufferedReader br;
          StringTokenizer st;
  
          public FastReader() {
              br = new BufferedReader(new InputStreamReader(System.in));
          }
  
          String next() {
              while (st == null || !st.hasMoreElements()) {
                  try {
                      st = new StringTokenizer(br.readLine());
                  } catch (IOException e) {
                      e.printStackTrace();
                  }
              }
              return st.nextToken();
          }
  
          int nextInt() {
              return Integer.parseInt(next());
          }
  
          long nextLong() {
              return Long.parseLong(next());
          }
  
          double nextDouble() {
              return Double.parseDouble(next());
          }
  
          String nextLine() {
              String str = "";
              try {
                  str = br.readLine();
              } catch (IOException e) {
                  e.printStackTrace();
              }
              return str;
          }
  
          int[] readintarray(int n) {
              int res[] = new int[n];
              for (int i = 0; i < n; i++)
                  res[i] = nextInt();
              return res;
          }
  
          long[] readlongarray(int n) {
              long res[] = new long[n];
              for (int i = 0; i < n; i++)
                  res[i] = nextLong();
              return res;
          }
      }
  
  }
  