#include <bits/stdc++.h>
using namespace std;
const long long M = 1e9 + 7;
int* prime;
bool sorter() { return true; }
long long intfromstring(string s) {
  int n = s.length();
  long long num = 0;
  for (long long i = 0; i < n; i += 1) num = num * 10 + (s[i] - '0');
  return num;
}
long long factn(long long n) {
  long long prod = 1;
  if (n == 0) return 1;
  for (long long i = 1; i < n + 1; i += 1) prod = ((prod % M) * (i % M)) % M;
  return prod % M;
}
long long factlogn(long long lo, long long hi) {
  if (hi - lo == 1) return hi * lo;
  if (hi - lo == 2) return hi * (hi - 1) * (lo);
  int mid = (hi + lo) / 2;
  return factlogn(lo, mid) * factlogn(mid + 1, hi);
}
long long binarySearch(long long arr[], long long lo, long long hi,
                       long long x) {
  if (hi - lo > 1) {
    long long mid = (lo + hi) / 2;
    if (arr[mid] == x) return mid;
    if (arr[mid] > x) return binarySearch(arr, lo, mid - 1, x);
    if (arr[mid] < x) return binarySearch(arr, mid + 1, hi, x);
  }
  return -1;
}
long long firstOccurence(long long arr[], long long lo, long long hi,
                         long long x) {
  if (hi - lo > 1) {
    long long mid = (lo + hi) / 2;
    if (arr[mid] == x) return firstOccurence(arr, lo, mid, x);
    if (arr[mid] < x) return firstOccurence(arr, mid + 1, hi, x);
    if (arr[mid] > x) return firstOccurence(arr, lo, mid - 1, x);
  }
  if (arr[lo] == x) return lo;
  if (arr[hi] == x) return hi;
  return -1;
}
long long lastOccurence(long long arr[], long long lo, long long hi,
                        long long x) {
  if (hi - lo > 1) {
    long long mid = (lo + hi) / 2;
    if (arr[mid] == x) return lastOccurence(arr, mid, hi, x);
    if (arr[mid] < x) return lastOccurence(arr, mid + 1, hi, x);
    if (arr[mid] > x) return lastOccurence(arr, lo, mid - 1, x);
  }
  if (arr[hi] == x) return hi;
  if (arr[lo] == x) return lo;
  return -1;
}
long long count(long long arr[], long long n, long long x) {
  return lastOccurence(arr, 0, n - 1, x) - firstOccurence(arr, 0, n - 1, x) + 1;
}
long long int maxl(long long int a, long long int b) {
  if (a > b) return a;
  return b;
}
long long int minl(long long int a, long long int b) {
  if (a < b) return a;
  return b;
}
long long int absl(long long int a) {
  if (a < 0) return -a;
  return a;
}
long long powb(long long base, long long po) {
  base %= M;
  if (base == 1 || po == 0) return 1;
  if (po == 1) return base % M;
  if (po & 1) {
    long long x = powb(base, po / 2) % M;
    return (((x * x) % M) * base) % M;
  }
  long long x = powb(base, po / 2) % M;
  return (x * x) % M;
}
long long powbwomom(long long base, long long po) {
  if (base == 1 || po == 0) return 1;
  if (po == 1) return base;
  if (po & 1) {
    long long x = powb(base, po / 2);
    return (((x * x)) * base);
  }
  long long x = powb(base, po / 2);
  return (x * x);
}
string Binary(long long n) {
  stack<char> bin;
  while (n) {
    if (n & 1)
      bin.push('1');
    else
      bin.push('0');
    n = n >> 1;
  }
  string str = "";
  while (bin.size()) {
    str.push_back(bin.top());
    bin.pop();
  }
  return str;
}
void sieve(int n) {
  prime = new int[n + 1];
  for (long long i = 0; i < n + 1; i += 1) prime[i] = 1;
  prime[0] = 0;
  prime[1] = 0;
  for (long long i = 2; i < sqrt(n) + 1; i += 1) {
    for (long long j = i * 2; j < n + 1; j += i) prime[j] = 0;
  }
}
void google(int a) {
  cout << "Case#" << a << ": ";
  return;
}
void testCase() {
  string s;
  cin >> s;
  int n = s.size();
  int con = 0;
  for (long long i = 0; i < n; i += 1) {
    if (s[i] == 'N') ++con;
  }
  if (con == 1) {
    cout << "NO" << '\n';
    return;
  }
  cout << "YES" << '\n';
  return;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int t = 1;
  cin >> t;
  int a = t;
  sieve(10001);
  while (t--) {
    testCase();
  }
  return 0;
}

### Prompt

Please provide a Cpp coded solution to the problem described below:

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].

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
const long long M = 1e9 + 7;
int* prime;
bool sorter() { return true; }
long long intfromstring(string s) {
  int n = s.length();
  long long num = 0;
  for (long long i = 0; i < n; i += 1) num = num * 10 + (s[i] - '0');
  return num;
}
long long factn(long long n) {
  long long prod = 1;
  if (n == 0) return 1;
  for (long long i = 1; i < n + 1; i += 1) prod = ((prod % M) * (i % M)) % M;
  return prod % M;
}
long long factlogn(long long lo, long long hi) {
  if (hi - lo == 1) return hi * lo;
  if (hi - lo == 2) return hi * (hi - 1) * (lo);
  int mid = (hi + lo) / 2;
  return factlogn(lo, mid) * factlogn(mid + 1, hi);
}
long long binarySearch(long long arr[], long long lo, long long hi,
                       long long x) {
  if (hi - lo > 1) {
    long long mid = (lo + hi) / 2;
    if (arr[mid] == x) return mid;
    if (arr[mid] > x) return binarySearch(arr, lo, mid - 1, x);
    if (arr[mid] < x) return binarySearch(arr, mid + 1, hi, x);
  }
  return -1;
}
long long firstOccurence(long long arr[], long long lo, long long hi,
                         long long x) {
  if (hi - lo > 1) {
    long long mid = (lo + hi) / 2;
    if (arr[mid] == x) return firstOccurence(arr, lo, mid, x);
    if (arr[mid] < x) return firstOccurence(arr, mid + 1, hi, x);
    if (arr[mid] > x) return firstOccurence(arr, lo, mid - 1, x);
  }
  if (arr[lo] == x) return lo;
  if (arr[hi] == x) return hi;
  return -1;
}
long long lastOccurence(long long arr[], long long lo, long long hi,
                        long long x) {
  if (hi - lo > 1) {
    long long mid = (lo + hi) / 2;
    if (arr[mid] == x) return lastOccurence(arr, mid, hi, x);
    if (arr[mid] < x) return lastOccurence(arr, mid + 1, hi, x);
    if (arr[mid] > x) return lastOccurence(arr, lo, mid - 1, x);
  }
  if (arr[hi] == x) return hi;
  if (arr[lo] == x) return lo;
  return -1;
}
long long count(long long arr[], long long n, long long x) {
  return lastOccurence(arr, 0, n - 1, x) - firstOccurence(arr, 0, n - 1, x) + 1;
}
long long int maxl(long long int a, long long int b) {
  if (a > b) return a;
  return b;
}
long long int minl(long long int a, long long int b) {
  if (a < b) return a;
  return b;
}
long long int absl(long long int a) {
  if (a < 0) return -a;
  return a;
}
long long powb(long long base, long long po) {
  base %= M;
  if (base == 1 || po == 0) return 1;
  if (po == 1) return base % M;
  if (po & 1) {
    long long x = powb(base, po / 2) % M;
    return (((x * x) % M) * base) % M;
  }
  long long x = powb(base, po / 2) % M;
  return (x * x) % M;
}
long long powbwomom(long long base, long long po) {
  if (base == 1 || po == 0) return 1;
  if (po == 1) return base;
  if (po & 1) {
    long long x = powb(base, po / 2);
    return (((x * x)) * base);
  }
  long long x = powb(base, po / 2);
  return (x * x);
}
string Binary(long long n) {
  stack<char> bin;
  while (n) {
    if (n & 1)
      bin.push('1');
    else
      bin.push('0');
    n = n >> 1;
  }
  string str = "";
  while (bin.size()) {
    str.push_back(bin.top());
    bin.pop();
  }
  return str;
}
void sieve(int n) {
  prime = new int[n + 1];
  for (long long i = 0; i < n + 1; i += 1) prime[i] = 1;
  prime[0] = 0;
  prime[1] = 0;
  for (long long i = 2; i < sqrt(n) + 1; i += 1) {
    for (long long j = i * 2; j < n + 1; j += i) prime[j] = 0;
  }
}
void google(int a) {
  cout << "Case#" << a << ": ";
  return;
}
void testCase() {
  string s;
  cin >> s;
  int n = s.size();
  int con = 0;
  for (long long i = 0; i < n; i += 1) {
    if (s[i] == 'N') ++con;
  }
  if (con == 1) {
    cout << "NO" << '\n';
    return;
  }
  cout << "YES" << '\n';
  return;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int t = 1;
  cin >> t;
  int a = t;
  sieve(10001);
  while (t--) {
    testCase();
  }
  return 0;
}

```