//http://acm.pku.edu.cn/JudgeOnline/problem?id=2632
//模拟机器人行走,向左转1次等于向右转3次
import java.math.*;
import java.util.Arrays;
import java.util.Scanner;
public class Main
{
public static int X,Y;
public static int getDir(char c)
{
if(c=='N')return 0;
if(c=='E')return 1;
if(c=='S')return 2;
return 3;
}
public static int[][] D={{0,1},{1,0},{0,-1},{-1,0}};
public static void main(String[] args)
{
Scanner scan = new Scanner(System.in);
int T = scan.nextInt();
for(int t=0;t<T;t++)
{
X=scan.nextInt();
Y=scan.nextInt();
int n=scan.nextInt();
int m=scan.nextInt();
//System.out.println(X+" "+Y+" "+n+" "+m);
int[][] a=new int [X+1][Y+1];
int[] rb_x =new int[n+1];
int[] rb_y =new int[n+1];
int[] rb_d =new int[n+1];
//Arrays.fill(a, {0});
for(int i=1;i<=X;i++)
for(int j=1;j<=Y;j++)
a[i][j]=0;
for(int i=1;i<=n;i++)
{
rb_x[i]=scan.nextInt();
rb_y[i]=scan.nextInt();
String str=scan.next();
rb_d[i]=getDir(str.charAt(0));
//System.out.println(rb_x[i]+" "+rb_y[i]);
a[rb_x[i]][rb_y[i]]=i;
}
int num;
String op;
int repeat;
int ans=0;//0:ok 1:crash wall 2:crash reboot
int f=-1,s=-1;
for(int i=0;i<m;i++)
{
num=scan.nextInt();
op=scan.next();
repeat=scan.nextInt();
if(ans!=0)continue;
if(op.charAt(0)=='F')
{
for(int j=0;j<repeat;j++)
{
a[rb_x[num]][rb_y[num]]=0;
rb_x[num]+=D[rb_d[num]][0];
rb_y[num]+=D[rb_d[num]][1];
if(rb_x[num]<=0||rb_x[num]>X||rb_y[num]<=0||rb_y[num]>Y){ans=1;f=num;break;}
if(a[rb_x[num]][rb_y[num]]!=0&&a[rb_x[num]][rb_y[num]]!=num){ans=2;f=num;s=a[rb_x[num]][rb_y[num]];break;}
a[rb_x[num]][rb_y[num]]=num;
}
}
else if(op.charAt(0)=='R')
{
rb_d[num]=(rb_d[num]+repeat)%4;
}
else if(op.charAt(0)=='L')
{
rb_d[num]=(rb_d[num]+repeat*3)%4;
}
}
if(ans==0)System.out.println("OK");
else if(ans==1)System.out.println("Robot "+f+" crashes into the wall");
else if(ans==2)System.out.println("Robot "+f+" crashes into robot "+s);
}
}
}