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 MBThe 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.
The input holds several test cases.
The first line of a test case holds the number of queries K (0<K≤103). The second line holds two integers N and M, the coordinates of the divider point (−104<N,M<104). Each of the next K lines holds two integers X and Y, the coordinates of one house (−104≤X,Y≤104).
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.
For each query print one line: