#include<bits/stdc++.h>

using namespace std;

const int vy[] = {1, 0, -1, 0};
const int vx[] = {0, 1, 0, -1};
const string vv = "NESW";

int N, X0, Y0, T;
bool mat[52][52][4];
int dir[1001];

int main()
{

  memset(dir, -1, sizeof(dir));

  cin >> N >> X0 >> Y0 >> T;
  for(int i = 0; i < N; i++) {
    int sx, sy, gx, gy;
    cin >> sx >> sy >> gx >> gy;
    if(sx > gx) swap(sx, gx);
    if(sy > gy) swap(sy, gy);
    if(sx == gx) {
      for(int j = sy; j < gy; j++) {
        mat[j][sx][0] = true;
        mat[j + 1][sx][2] = true;
      }
    } else {
      for(int j = sx; j < gx; j++) {
        mat[sy][j][1] = true;
        mat[sy][j + 1][3] = true;
      }
    }
  }

  int st = 0;
  for(int i = 0; i < T; i++) {
    int a;
    char b;
    cin >> a >> b;
    st += a;
    dir[st] = (int) vv.find(b);
  }

  int latte[51][51][4] = {{{}}};
  for(int i = 0; i < 4; i++) latte[Y0][X0][i] = true;

  for(int i = 1; i <= st; i++) {
    int malta[51][51][4] = {{{}}};
    for(int j = 0; j <= 50; j++) {
      for(int k = 0; k <= 50; k++) {
        for(int l = 0; l < 4; l++) {
          if(!latte[j][k][l]) continue;
          for(int m = -1; m <= 1; m++) {
            int ndir = (l + m + 4) % 4;
            int ny = j + vy[l], nx = k + vx[l];
            if(ny < 0 || nx < 0) continue;
            if(!mat[ny][nx][ndir]) continue;
            if(~dir[i] && l != dir[i] && ndir != dir[i]) continue;
            malta[ny][nx][ndir] = true;
          }
        }
      }
    }

    swap(latte, malta);
  }

  set< pair< int, int > > vs;
  for(int i = 0; i <= 50; i++) {
    for(int j = 0; j <= 50; j++) {
      for(int k = 0; k < 4; k++) {
        if(latte[i][j][k]) vs.emplace(j, i);
      }
    }
  }
  for(auto &p : vs) {
    cout << p.first << " " << p.second << endl;
  }


}