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.awt.*;
  import java.awt.desktop.SystemEventListener;
  import java.io.*;
  import java.text.DecimalFormat;
  import java.util.*;
  import java.util.concurrent.locks.ReadWriteLock;
  
  
  public class Main {
  
      public static void main(String[] args) throws IOException {
          Reader.init(System.in);
          BufferedWriter output = new BufferedWriter(new OutputStreamWriter(System.out));
          int t = Reader.nextInt();
          while ( t > 0){
              char [] string = Reader.next().toCharArray();
              int [] array = new int[string.length];
              int i = 0;
              int current = 0;
              boolean ans = true;
              while ( i < string.length){
                  if ( string[i] == 'N'){
                      current++;
                  }
                  i++;
              }
              if (current != 1){
                  System.out.println("YES");
              }
              else{
                  System.out.println("NO");
              }
  
              t--;
          }
          output.flush();
  
  
      }
      public static int sub(int a, int b){
         int half = b/2;
         if ( b%2 == 0){
             if ( a < half){
                 return 1;
             }
             else{
                 return -1;
             }
         }
         else{
             if ( a<= half){
                 return 1;
             }
             else{
                 return -1;
             }
         }
      }
  
  
      private static int bs(int low,int high,int[] array,int find){
          if ( low <= high ){
              int  mid = low + (high-low)/2;
              if ( array[mid] > find){
                  high = mid -1;
                  return bs(low,high,array,find);
              }
              else if ( array[mid] < find){
                  low = mid+1;
                  return bs(low,high,array,find);
              }
              return mid;
          }
          return -1;
      }
  
      private static int max(int a, int b) {
          return  Math.max(a,b);
      }
  
      private static int min(int a,int b){
          return  Math.min(a,b);
      }
  
      public static long modularExponentiation(long a,long b,long mod){
          if ( b == 1){
              return a;
          }
          else{
              long ans = modularExponentiation(a,b/2,mod)%mod;
              if ( b%2 == 1){
                  return (a*((ans*ans)%mod))%mod;
              }
  
              return ((ans*ans)%mod);
          }
      }
  
      public static long sum(long n){
          return  (n*(n+1))/2;
      }
      public static long abs(long a){
          return a < 0 ? (-1*a) : a;
      }
      public static long gcd(long a,long b){
          if ( a == 0){
              return b;
          }
          else{
              return gcd(b%a,a);
          }
      }
  
  
  }
  
  class Reader {
      static BufferedReader reader;
      static StringTokenizer tokenizer;
  
  
      static void init(InputStream input) {
          reader = new BufferedReader(
                  new InputStreamReader(input));
          tokenizer = new StringTokenizer("");
      }
  
      static String next() throws IOException {
          while ( ! tokenizer.hasMoreTokens() ) {
  
              tokenizer = new StringTokenizer(
                      reader.readLine() );
          }
          return tokenizer.nextToken();
      }
  
      static int nextInt() throws IOException {
          return Integer.parseInt( next() );
      }
  
      static double nextDouble() throws IOException {
          return Double.parseDouble( next() );
      }
  
      static long nextLong() throws IOException{
          return Long.parseLong(next());
      }
  }
  
  class NComparator implements Comparator<Node>{
      @Override
      public int compare(Node o1, Node o2) {
          if ( o2.position > o1.position){
              return 1;
          }
          else if ( o2.position < o1.position){
              return -1;
          }
          else{
              if ( o2.time < o1.time){
                  return 1;
              }
              else if ( o2.time > o2.time){
                  return -1;
              }
              else{
                  return 0;
              }
          }
      }
  }
  class DComparator implements Comparator<Integer>{
      @Override
      public int compare(Integer o1, Integer o2) {
          if ( o2 > o1){
              return 1;
          }
          else if ( o2 < o1){
              return -1;
          }
          else{
              return 0;
          }
      }
  }
  
  
  class Node{
      int position;
      long time;
  
      Node(int p,long t){
          position = p;
          time = t;
      }
  
  }