P9945 [USACO21FEB] Clockwise Fence B

Description

The fence surrounding Farmer John’s largest pasture has broken, and he has finally decided to replace it with a new one. Unfortunately, while Farmer John was building the new fence, a huge bee suddenly appeared and chased him around his pasture, causing the fence to be built along a rather irregular path. The fence can be represented by a string, where each character is one of `N` (north), `E` (east), `S` (south), `W` (west). Each character represents a $1$-meter-long segment of fence. For example, if the string is `NESW`, this means the fence extends $1$ meter north from the starting point, then $1$ meter east, then $1$ meter south, then $1$ meter west, returning to the fence’s starting point. The ending position of the fence is the same as the starting position, and this is the only position on the fence’s path that is reached multiple times (so the starting position is the only position that is visited again, at the end of the fence). As a result, the fence does enclose a connected region of the pasture, although this region may have a very strange shape. Farmer John wants to know whether the path he built is clockwise (when walking along the fence in the order given by the string, the enclosed region is on the right) or counterclockwise (the enclosed region is on the left).

Input Format

The first line of input contains an integer $N$ ($1 \le N \le 20$). Each of the next $N$ lines contains a string of length at least $4$ and at most $100$, describing a fence path.

Output Format

For each of the $N$ input fence paths, output one line: `CW` (clockwise) or `CCW` (counterclockwise).

Explanation/Hint

### Sample Explanation 1 Below are the two fence paths, with `@` marking the starting position: ```plain *>* ^ v @