BlueBook - Direction

View as PDF

Submit solution

Points: 3
Time limit: 1.0s
Memory limit: 16M

Problem type
BlueBook

Given an integer N (0 \le N < 360), print out the closest compass bearing to that integer if N is the bearing in degrees. If there is a tie, print the "smaller" of the two possible outputs.

The bearings arranged in increasing order of "size" are: N, E, S, W. This means choose N over E if the input is 45^{\circ}, and N over W when the input is 315^{\circ}.

Input Specification

The input consists of an integer T (1 \le T \le 1\,000), denoting the number of test cases and then each line following consists of one integer N.

Output Specification

Output the closest compass bearing according to the input.

Sample Input

2
45
180

Sample Output

N
S

Comments

There are no comments at the moment.