#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;

const int dy[] = {1,0,-1,0}, dx[] = {0,1,0,-1};
const string news = "NESW";

int main(){
  int n,x0,y0,t;
  bool g[51][51][4] = {};
  cin >> n >> x0 >> y0 >> t;

  while(n--){
    int x1,y1,x2,y2;
    cin >> x1 >> y1 >> x2 >> y2;
    int dify = y2-y1, difx = x2-x1;
    if(dify)dify /= abs(y2-y1); if(difx)difx /= abs(x2-x1);

    rep(d,4){
      if(dy[d] == dify && dx[d] == difx){
	int cy = y1, cx = x1;
	while(cy!=y2 || cx!=x2){
	  g[cy][cx][d] = 1;
	  cy += dy[d]; cx += dx[d];
	  g[cy][cx][(d+2)%4] = 1;
	}
      }
    }
  }

  int cur[51][51][4], nxt[51][51][4];
  memset(cur,0,sizeof(cur));
  rep(d,4)cur[y0][x0][d] = 1;

  while(t--){
    int dis; char dir;
    cin >> dis >> dir;
    while(dis--){
      memset(nxt,0,sizeof(nxt));

      rep(i,51)rep(j,51)rep(d,4){
	if(cur[i][j][d]==2){
	  for(int k=-1;k<=1;k++){
	    int nd = (d+k+4)%4, ny = i+dy[nd], nx = j+dx[nd];
	    if(g[i][j][nd])nxt[ny][nx][nd] = 2;
	  }
	}else if(cur[i][j][d]==1){
	  int ny = i+dy[d], nx = j+dx[d];
	  if(g[i][j][d])nxt[ny][nx][d] = 2;
	}
      }

      swap(cur,nxt);
    }

    memset(nxt,0,sizeof(nxt));
    
    rep(i,51)rep(j,51)rep(d,4){
      if(cur[i][j][d]){
	if(news[d]==dir)nxt[i][j][d] = 2;
	else{
	  for(int k=-1;k<=1;k++){
	    int nd = (d+k+4)%4;
	    if(g[i][j][nd] && news[nd]==dir)nxt[i][j][nd] = max(nxt[i][j][nd],1);
	  }
	}
      }
    }
    swap(cur,nxt);
  }

  rep(x,51)rep(y,51){
    bool f = false;
    rep(d,4)f |= cur[y][x][d]>0;
    if(f)cout << x << " " << y << endl;
  }
}