Back To Home

3.2

4 votes
Easy
Problem

Deepti's mom want to spend some time at home alone and for this she gave her some list of directions to follow. She gave her some random list like north-south-east-west and tell her to follow each direction for 5 minutes.

As Deepti's mom want deepti to come home after following the list of directions so she want list that take Deepti back to home.

Deepti's mom want your help, she give you the list of directions and you tell her whether this is right or not.

Input Format:

First line contain an integer denoting number of test cases,T.Then T lines follow, each line contains a string of lower case letters -n,s,e and w.

Where n for North, s for South, e for East and w for West.

Output Format:

For T test cases ,T lines each line will print "YES" if this takes Deepti back to home otherwise "No".

Constraints : 1<=T<=500

Time Limit: 5
Memory Limit: 256
Source Limit:
Editor Image

?