#include <bits/stdc++.h>
using namespace std;

#define rep(i,x,y) for(ll i=(x);i<(y);++i)
#define debug(x) #x << "=" << (x)

#ifdef DEBUG
#define _GLIBCXX_DEBUG
#define show(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define show(x)
#endif

typedef long long int ll;
typedef pair<ll,ll> pii;
template<typename T> using vec=std::vector<T>;

const ll inf=1<<30;
const long long int infll=1LL<<62;
const double eps=1e-9;

template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){
    os << "[";
    for (const auto &v : vec) {
    	os << v << ",";
    }
    os << "]";
    return os;
}

void solve(){
    ll n,x0,y0,t;
    cin >> n >> x0 >> y0 >> t;

    static bool is_street[51][51][51][51];
    rep(i,0,n){
        ll xs,ys,xe,ye;
        cin >> xs >> ys >> xe >> ye;
        if(xs>xe) swap(xs,xe);
        if(ys>ye) swap(ys,ye);
        if(xs==xe) rep(y,ys,ye) is_street[xs][y][xs][y+1]=is_street[xs][y+1][xs][y]=true;
        if(ys==ye) rep(x,xs,xe) is_street[x][ys][x+1][ys]=is_street[x+1][ys][x][ys]=true;
    }
    int cs[1024],sum=0;
    fill_n((int*)cs,1024,-1);
    rep(i,0,t){
        ll d;
        char c;
        cin >> d >> c;
        sum+=d;
        if(c=='E') cs[sum]=0;
        if(c=='N') cs[sum]=1;
        if(c=='W') cs[sum]=2;
        if(c=='S') cs[sum]=3;
    }

    const ll dx[]={1,0,-1,0},dy[]={0,1,0,-1};
    static bool dp[1024][51][51][4];
    static bool done[1024][51][51][4];
    function<bool(int,int,int,int)> rec=[&](int dist,int x,int y,int dir){
        assert(x<=50);
        assert(y<=50);
        auto &res=dp[dist][x][y][dir];
        if(done[dist][x][y][dir]) return res;
        done[dist][x][y][dir]=true;
        if(!dist) return res=(x==x0 and y==y0);
        rep(i,0,4){
            int px=x-dx[i],py=y-dy[i];
            if(px<0 or 50<px or py<0 or 50<py or !is_street[x][y][px][py]) continue;
            if((i+2)%4==dir) continue;
            if(cs[dist]!=-1 and dir!=cs[dist] and i!=cs[dist]) continue;
            res|=rec(dist-1,px,py,i);
        }
        return res;
    };

    rep(x,0,51) rep(y,0,51){
        bool ok=false;
        rep(i,0,4){
            int nx=x+dx[i],ny=y+dy[i];
            if(nx<0 or 50<nx or ny<0 or 50<ny or !is_street[x][y][nx][ny]) continue;
            ok|=rec(sum,x,y,i);
        }
        if(ok) cout << x << " " << y << endl;
    }
}

int main(){
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(10);
    solve();
    return 0;
}