Олимпиадный тренинг

Задача 38489. Raft


Задача

Темы: Разбор случаев
A rectangular raft floats in the middle of the lake. The sides of the raft are directed along parallels and meridians. Let's introduce a coordinate system in which the OX  axis is directed to the east, and the OY axis – on North. Let the southwest corner of the raft have the coordinates  (x1, y1), the northeast corner – coordinates (x2, y2).
The swimmer is at the point with coordinates (x, y). Determine which side of the raft (north, south, west, or east) or which corner of the raft (northwest, northeast, southwest, southeast) the swimmer needs to swim to get to as soon as possible to the raft.
The program receives six numbers as input in the following order: x1, y1 (coordinates of the southwest corner of the raft), x2, y 2 (coordinates of the northeast corner of the raft), x, y (coordinates swimmer). All numbers are integers and do not exceed 100 in absolute value. It is guaranteed that x1 < x2, y1 < y2, x ≠ x1, x ≠ x2, y ≠ y1, y ≠ y2, the swimmer coordinates are outside the raft.
If the swimmer should swim to the north side of the raft, the program should output the character  "N", to the south– the symbol "S", to the western – symbol "W", to the eastern – the symbol "E". If the swimmer should swim to the corner of the raft, print one of the following lines: "NW", "NE", "SW", "SE".
 
Examples
# Input Output Explanation
1 -1
-2
5
3
-4
6
NW