#include <stdlib.h>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <iostream>
#include "testlib.h"

using namespace std;

const int max_side = 200;

/*void finish(int v)
{
    char c;

    if (v == 0)
    {
        //printf("WAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\n");
        //freopen("pawns.in", "r", stdin);
        //while (scanf("%c", &c) == 1)
        //    printf("%c", c);
        quitf(_wa, "")
    }
    else
        printf("OK\n");
}
*/

int main(int argc, char ** argv)
{
    registerTestlibCmd(argc, argv);

    int n, m, k, i, j, p, x, y, cnt, field[max_side][max_side];
    char an[3][100], cmd;

    //freopen("pawns.in", "r", stdin);
    //scanf("%d%d%d", &n, &m, &k);
    n = inf.readInt();
    inf.readSpace();
    m = inf.readInt();
    inf.readSpace();
    p = inf.readInt();
    inf.readSpace();
    k = inf.readInt();
    inf.readEoln();
    
    for (i = 0; i < p; i++)
    {
      x = inf.readInt();
      if (i != p - 1)
        inf.readSpace();
      field[1][x] = 2;
    }
    inf.readEoln();
    for (i = 0; i < k; i++)
    {
        //scanf("%d%d", &x, &y);
        x = inf.readInt();
        inf.readSpace();
        y = inf.readInt();
        inf.readEoln();

        field[x][y] = 1;
    }
    //for (i = 0; i < m; i++)
    //    field[1][i + 1] = 2;
    //fprintf(stderr, "here\n");
    //freopen("pawns.ans", "r", stdin);
    //scanf("%c", &ans[0][0]);
    an[0][0] = ans.readChar();
    if (an[0][0] == 'Y')
    {
        an[0][1] = ans.readChar();
        an[0][2] = ans.readChar();
        //scanf("%c%c", &ans[0][1], &ans[0][2]);
    }
    else
        //scanf("%c", &ans[0][1]);
        an[0][1] = ans.readChar();
    //ans[0] = buf;
    //fprintf(stderr, "here\n");
    //freopen("pawns.out", "r", stdin);
    //scanf("%c", &ans[1][0]);
    an[1][0] = ouf.readChar();
    if (an[1][0] == 'Y')
    {
        //scanf("%c%c", &ans[1][1], &ans[1][2]);
        an[1][1] = ouf.readChar();
        an[1][2] = ouf.readChar();
    }
    else
        //scanf("%c", &ans[1][1]);
        an[1][1] = ouf.readChar();
    //ans[1] = buf;
    //fprintf(stderr, "here\n");
    //fprintf(stderr,"here\n");
    //ans[0][0] = ans[0][0];
    //int shaman;
    //fprintf(stderr, "%c%c%c%c%c%c\n", ans[0][0], ans[0][1], ans[0][2], ans[1][0], ans[1][1], ans[1][2]);
    //fprintf(stderr, "%d%d%d", ans[0][0] == ans[1][0], ans[0][1] == ans[1][1], ans[1][2] == ans[0][2]);
    if (!(an[0][0] == an[1][0] && an[0][1] == an[1][1]))
    {
        quitf(_wa, "Answers dismatch");
        //finish(0);
        //return 0;
    }
    //else
    //    fprintf(stderr, "V rot mne nogi!\n");
    //fprintf(stderr, "%s%s", ans[2], ans[0]);
    //fprintf(stderr,"here\n");
    //fprintf(stderr, "%c\n", ans[1][0]);
    //fprintf(stderr, "%d %d\n", ans[1][0], ans[1][1]);
    if (an[1][0] == 'N')
    {
        quitf(_ok, "Answers match");
        //finish(1);
        //return 0;
    }
    //else
    //  fprintf(stderr, "here\n");
    //scanf("%d", &cnt);
    cnt = ouf.readInt();
    if (cnt > n * m)
        quitf(_wa, "too many commands");
    ouf.readEoln();
    for (i = 0; i < cnt; i++)
    {
        //scanf("%d%d%c%c", &x, &y, &cmd, &cmd);
        x = ouf.readInt();
        y = ouf.readInt();
        ouf.readSpace();
        cmd = ouf.readChar();
        //fprintf(stderr,"%d %d %c\n", x, y, cmd);
        if (cnt > n * m || x < 1 || x > n || y < 1 || y > m || field[x][y] != 2)
        {
            quitf(_wa, "wrong position in command %d", i + 1);
            //finish(0);
            //return 0;
        }
        //char right = cmd;
        //fprintf(stderr, "here  [%d %d]  %d %d %d\n", right, cmd,  cmd == 'F', right == 'R', cmd == 'L');

        if (!((cmd == 'F') || (cmd == 'R') || (cmd == 'L')))
        {
            quitf(_wa, "wrong move indentifier in command %d", i + 1);
            //finish(0);
            //return 0;
        }
        //fprintf(stderr, "here\n");
        if (cmd == 'F')
            if (x == n || field[x + 1][y] != 0)
            {
                quitf(_wa, "impossible move in command %d", i + 1);
                //finish(0);
                //return 0;
            }
            else
            {
                field[x + 1][y] = 2;
                field[x][y] = 0;
            }
        if (cmd == 'L')
            if (x == n || y == 1 || field[x + 1][y - 1] != 1)
            {
                quitf(_wa, "impossible move in command %d", i + 1);
                //finish(0);
                //return 0;
            }
            else
            {
                field[x + 1][y - 1] = 2;
                field[x][y] = 0;
            }
        if (cmd == 'R')
            if (x == n || y == m || field[x + 1][y + 1] != 1)
            {
                quitf(_wa, "impossible move in command %d", i + 1);
                //finish(0);
                //return 0;
            }
            else
            {
                field[x + 1][y + 1] = 2;
                field[x][y] = 0;
            }
    }

    for (i = 1; i <= n; i++)
        for (j = 1; j <= m; j++)
            if (field[i][j] == 1)
            {
                quitf(_wa, "some pawns are still on the desk, but all moves are done");
                //finish(0);
                //return 0;
            }
    quitf(_ok, "all moves are correct, no pawns on the desk");

    return 0;

}
