import java.util.*;
public class Main {
public static void main(String [] args) {
Scanner scn = new Scanner (System.in);
int n = 1;
n = scn.nextInt();
while(n != 0) {
int x = scn.nextInt();
int y = scn.nextInt();
for(int c=0;c<n;c++) {
int a = scn.nextInt();
int b = scn.nextInt();
if(a == x || b == y)
System.out.println("divisa");
else if (a > x) {
if (b > y)
System.out.println("NE");
else if (b < y)
System.out.println("SE");
}
else if (a < x) {
if (b > y)
System.out.println("NO");
else if (b < y)
System.out.println("SO");
}
}
n = scn.nextInt();
}
}
}