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:  /* package codechef; // don't place package name! */
  import java.util.*;
  import java.lang.*;
  import java.io.*;
  import java.math.BigInteger;
   
   
   
   
   
  public class hello{
   
     static class Pair implements Comparable<Pair>{
   
      long val;
      long ind;
      public Pair(long val,long ind)
      {
          this.val=val;
          this.ind=ind;
      }
   
      public int compareTo(Pair o)
      {
          return Long.compare(this.val, o.val);
  }
  }
       static class FastReader 
      { 
          BufferedReader br; 
          StringTokenizer st; 
    
          public FastReader() 
          { 
              try {
                 br=new BufferedReader(new FileReader("input.txt"));
                 PrintStream out= new PrintStream(new FileOutputStream("output.txt"));
                 System.setOut(out);
              }
    
              // Catch block to handle the exceptions
              catch (Exception e) {
                  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; 
          } 
      } 
       static int computeXOR(int n)
      {
          // If n is a multiple of 4
          if (n % 4 == 0)
              return n;
        
          // If n%4 gives remainder 1
          if (n % 4 == 1)
              return 1;
        
          // If n%4 gives remainder 2
          if (n % 4 == 2)
              return n + 1;
        
          // If n%4 gives remainder 3
          return 0;
      }
      static long helper(List<Long> l,long k)
      {
          int length = l.size()-1;
          long val = 0;
  
          while(length>=0)
          {
              val+=2*(l.get(length));
              length-=k;
          }
  
          return val;
      }
  
     static long findGCD(long a, long b){
      if(b == 0)
        return a;
      return findGCD(b, a%b);
  }
      public static void main (String[] args) throws java.lang.Exception
      {
   
         try{
          FastReader sc=new FastReader();
          BufferedWriter out = new BufferedWriter(
              new OutputStreamWriter(System.out));
          int t = sc.nextInt();
          while(t-->0)
          {
              String s = sc.next();
  
             
             HashSet<Character> set = new HashSet<>();
  
             for(int i=0;i<s.length();i++)
             {
                set.add(s.charAt(i));
             }
  
             if(set.size() == 1)
              System.out.println("Yes");
             else
             {
                List<Integer> list = new ArrayList<>();
  
                int count = 1;
  
                if(s.charAt(0) == 'E')
                {
                  list.add(1);
                  list.add(1);
                }
                else
                {
                  list.add(1);
                  list.add(2);
                  count = 2;
                }
  
                for(int i=1;i<s.length()-1;i++)
                {
                    if(s.charAt(i) == 'E')
                    {
                        list.add(count);
                    }
                    else
                    {
                        count++;
                        list.add(count);
                    }
                }
  
  
                boolean yes = true;
  
                int idx = 0;
  
                for(int i = s.length()-2;i>=0;i--)
                {
                      if(s.charAt(i) == 'N')
                      {
                          idx = i;
                          yes=false;
                          break;
                      }
                }
  
                if(yes)
                {
                    if(s.charAt(s.length()-1) == 'N')
                    {
                        System.out.println("No");
                    }
                }
                else
                {
                     if(idx == 0)
                     {
                         if(s.charAt(s.length()-1) == 'N')
                        System.out.println("Yes");
                        else
                        System.out.println("No");
                     }
                     else
                     {
                          if(list.get(idx+1)>2)
                          System.out.println("Yes");
                          else if(s.charAt(s.length()-1) == 'N')
                          System.out.println("Yes");
                          else
                          System.out.println("No");
                     }
                }
             }
  
  
          }
      }catch(Exception e){
              return;
          }
      }
  }