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.io.*;
  import java.util.Arrays;
  import java.util.StringTokenizer;
  
  public class Main {
      public static void main(String[] args) throws Exception {
          int T = in.nextInt();
          while (T-- > 0) {
              long N = 0;
              char[]a = in.readLine().toCharArray();
              for (int i = 0; i < a.length; i ++){
                  if(a[i] == 'N') N ++;
              }
  
              out.println((N == 1)? "NO" : "YES");
              out.flush();
          }
  
          out.close();
      }
  
      static class Kattio extends PrintWriter {
          private BufferedReader r;
          private StringTokenizer st;
  
          // standard input
          public Kattio() {
              this(System.in, System.out);
          }
  
          public Kattio(InputStream i, OutputStream o) {
              super(o);
              r = new BufferedReader(new InputStreamReader(i));
          }
  
          // USACO-style file input
          public Kattio(String problemName) throws IOException {
              super(new FileWriter(problemName + ".out"));
              r = new BufferedReader(new FileReader(problemName + ".in"));
          }
  
          // returns null if no more input
          public String next() {
              try {
                  while (st == null || !st.hasMoreTokens())
                      st = new StringTokenizer(r.readLine());
                  return st.nextToken();
              } catch (Exception e) {
              }
              return null;
          }
  
          public int nextInt() {
              return Integer.parseInt(next());
          }
  
          public double nextDouble() {
              return Double.parseDouble(next());
          }
  
          public long nextLong() {
              return Long.parseLong(next());
          }
  
          public String readLine() throws Exception {
              return r.readLine();
          }
  
          public long[] readArrayLong(int n) {
              long[] arr = new long[n];
              for (int i = 0; i < n; i++)
                  arr[i] = nextLong();
              return arr;
          }
  
          public Integer[] readArrayI(int n) {
              Integer[] arr = new Integer[n];
              for (int i = 0; i < n; i++)
                  arr[i] = nextInt();
              return arr;
          }
  
          public int[] readArray(int n) {
              int[] arr = new int[n];
              for (int i = 0; i < n; i++)
                  arr[i] = nextInt();
              return arr;
          }
  
          public int[]prefixSum(int N, int[]a){
              int[]nw = new int[N + 1];
              nw[0] = 0;
              for (int i = 0; i < N; i ++) {
                  nw[i + 1] = nw[i] + a[i];
              }
  
              return nw;
          }
  
          public int[][] prefixSum(int N, int[][]grid){
              int[][]pfx = new int[grid.length][grid.length];
              for (int i = 1; i < N + 1; i++) {
                  for (int j = 1; j < N + 1; j++) {
                      pfx[i][j] = grid[i][j]
                              + pfx[i-1][j]
                              + pfx[i][j-1]
                              - pfx[i-1][j-1];
                  }
              }
  
              return pfx;
          }
  
          public int prefixSum2D(int x1, int y1, int x2, int y2, int[][]pfx) {
              return pfx[x2][y2] - pfx[x1-1][y2] - pfx[x2][y1-1] + pfx[x1-1][y1-1];
          }
      }
      static final Kattio in = new Kattio();
      static final PrintWriter out = new PrintWriter(System.out);
      static class Pair implements Comparable<Pair> {
          int x, y;
  
          Pair (int x, int y) {
              this.x = x;
              this.y = y;
          }
  
          @Override
          public int compareTo (Pair other) {
              return Integer.compare(this.x, other.x);
          }
          public String toString() { return x + " " + y;}
      }
  }
  