from collections import deque as D
Z=int;I=input;R=range
N,M=map(Z,I().split())
S={};X={};Y={}
for i in R(1,N+1):
 x,y=map(Z,I().split())
 S[i]=(x,y)
 if not y in X:X[y]=[]
 X[y].append((x,i))
 if not x in Y:Y[x]=[]
 Y[x].append((y,i))
for y in X:X[y]=D(sorted(X[y]))
for x in Y:Y[x]=D(sorted(Y[x]))
for _ in R(M):
 i,d=I().split();i=Z(i)
 if not i in S:print('ignore');continue
 x,y=S[i]
 E=[]
 if d=='N':
  _,s=Y[x][-1]
  while s!=i:
   if s in S:E.append(s);del S[s]
   Y[x].pop();_,s=Y[x][-1]
 if d=='S':
  _,s=Y[x][0]
  while s!=i:
   if s in S:E.append(s);del S[s]
   Y[x].popleft();_,s=Y[x][0]
 if d=='E':
  _,s=X[y][-1]
  while s!=i:
   if s in S:E.append(s);del S[s]
   X[y].pop();_,s=X[y][-1]
 if d=='W':
  _,s=X[y][0]
  while s!=i:
   if s in S:E.append(s);del S[s]
   X[y].popleft();_,s=X[y][0]
 E.append(len(E))
 print(' '.join([str(e)for e in E[::-1]]))
