#include<bits/stdc++.h>
using namespace std;
#define int long long
bool dp[4][55][55][1111];
bool edge[4][55][55];

struct st{
  int d,y,x,t;
  st(){}
  st(int d,int y,int x,int t):d(d),y(y),x(x),t(t){}
};

signed main(){
  memset(edge,0,sizeof(edge));
  int n,x0,y0,T;
  cin>>n>>x0>>y0>>T;
  for(int i=0;i<n;i++){
    int xs,ys,xt,yt;
    cin>>xs>>ys>>xt>>yt;
    if(xs==xt){
      if(ys>yt) swap(ys,yt);
      for(int j=ys;j<yt;j++) edge[0][j][xs]=1;
      for(int j=yt;j>ys;j--) edge[2][j][xs]=1;
    }else{
      if(xs>xt) swap(xs,xt);
      for(int j=xs;j<xt;j++) edge[1][ys][j]=1;
      for(int j=xt;j>xs;j--) edge[3][ys][j]=1;
    }
  }
  
  int e;
  map<int,int> m;
  for(int i=0,tmp=0;i<T;i++){
    int d;char c;
    cin>>d>>c;
    tmp+=d;
    if(c=='N') m[tmp]=0;
    if(c=='E') m[tmp]=1;
    if(c=='S') m[tmp]=2;
    if(c=='W') m[tmp]=3;
    e=tmp;
  }
  
  int ay[]={1,0,-1,0};
  int ax[]={0,1,0,-1};

  typedef pair<int,int> P;
  vector<P> ans;

  memset(dp,0,sizeof(dp));
  queue<st> q;
  for(int k=0;k<4;k++){
    if(edge[k][y0][x0]){
      dp[k][y0][x0][0]=1;
      q.push(st(k,y0,x0,0));
    }
  }
  while(!q.empty()){
    st p=q.front();q.pop();
    int d=p.d,y=p.y,x=p.x,t=p.t;
    //cout<<d<<" "<<y<<" "<<x<<" "<<t<<endl;
    if(t>e+1) break;
    if(t==e+1){
      ans.push_back(P(x-ax[d],y-ay[d]));
      continue;
    }
    for(int k=0;k<4;k++){
      if(!edge[k][y][x]) continue;
      int nd=k,ny=y+ay[k],nx=x+ax[k],nt=t+1;
      if(nd==(d+2)%4) continue;
      //if(m.count(t)) cout<<":"<<nd<<" "<<ny<<" "<<nx<<" "<<nt<<endl;
      if(m.count(t)&&m[t]!=d&&m[t]!=nd) continue;
      if(dp[nd][ny][nx][nt]) continue;
      dp[nd][ny][nx][nt]=1;
      q.push(st(nd,ny,nx,nt));
    }
  }
  
  sort(ans.begin(),ans.end());
  ans.erase(unique(ans.begin(),ans.end()),ans.end());
  for(P p:ans) cout<<p.first<<" "<<p.second<<endl;
  return 0;
}