Dividing Nlogônia

Given a divider point, classify each house coordinate into one of four quadrants or as lying on a dividing line.

Easy2ImplementationMathNo attempts yetTime limit2sMemory limit512 MB

Problem

The four peoples of Nlogônia fought each other for centuries. After decades of negotiation, everyone agreed on how to split the country into four independent territories.

The negotiations fixed the coordinates of one point, called the divider point. Two lines are drawn on the map through the divider point, one running north to south and one running east to west. The two lines cut the country into four new countries. Starting from the quadrant that lies farthest north and farthest west and going clockwise, the new countries are named Northwest Nlogônia, Northeast Nlogônia, Southeast Nlogônia and Southwest Nlogônia.

Implement the system that tells a resident which of the four countries the house belongs to.

Input

The input holds several test cases.

The first line of a test case holds the number of queries KK (0<K1030 < K \le 10^3). The second line holds two integers NN and MM, the coordinates of the divider point (104<N,M<104-10^4 < N, M < 10^4). Each of the next KK lines holds two integers XX and YY, the coordinates of one house (104X,Y104-10^4 \le X, Y \le 10^4).

In every coordinate the first value gives the east to west direction and the second value gives the north to south direction. A larger value means farther east and farther north.

A line holding only the number zero ends the input.

Output

For each query print one line:

  • divisa if the house sits on one of the two dividing lines, the north to south line or the east to west line
  • NO if the house is in Northwest Nlogônia
  • NE if the house is in Northeast Nlogônia
  • SE if the house is in Southeast Nlogônia
  • SO if the house is in Southwest Nlogônia