#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
//#define int ll
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
//#define mt make_tuple
//typedef tuple<pii,int,int> tp;
//typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
//template<class C>constexpr int size(const C &c){return (int)c.size();}
//template<class T,size_t N> constexpr int size(const T (&xs)[N])noexcept{return (int)N;}
const double PI=acos(-1);
const double EPS=1e-7;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
int main(){
	int n,X,Y;
	cin>>n>>X>>Y;
	vp in(n);
	rep(i,n){
		int a,b;char d;
		pii c;
		cin>>a>>b>>d;
		if(d=='N')c={a,Y-b};
		if(d=='E')c={X+Y-b,X-a};
		if(d=='S')c={X+Y+X-a,b};
		if(d=='W')c={X+Y+X+b,a};
		int l=c.first-c.second,r=c.first+c.second;
		if(l<0)l+=X+X+Y+Y,r+=X+X+Y+Y;
		in[i]={r,l};
	}
	int out=inf;
//	rep(i,n)cout<<in[i].second<<" "<<in[i].first<<endl;
	rep(i,2*n){
		sort(all(in));
		int co=0;
		int mi=-1;
	//	rep(j,n)cout<<in[j].second<<" "<<in[j].first<<endl;
		rep(j,n){
			if(mi<in[j].second){
				mi=in[j].first;
				co++;
			}
//			cout<<mi<<" "<<co<<endl;
		}
//		if(co==6){
//			cout<<i<<endl;
//			rep(j,n)cout<<in[j].second<<" "<<in[j].first<<endl;
//			return 0;
//		}
		out=min(out,co);
		in.pb({in[0].first+X+X+Y+Y,in[0].second+X+X+Y+Y});
		in.erase(in.begin());
	}
	cout<<out<<endl;
}
### Prompt

Your challenge is to write a Cpp solution to the following problem:

Example

Input

2 10 6
4 4 E
6 4 W


Output

2

### Response

```cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
//#define int ll
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
//#define mt make_tuple
//typedef tuple<pii,int,int> tp;
//typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
//template<class C>constexpr int size(const C &c){return (int)c.size();}
//template<class T,size_t N> constexpr int size(const T (&xs)[N])noexcept{return (int)N;}
const double PI=acos(-1);
const double EPS=1e-7;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
int main(){
	int n,X,Y;
	cin>>n>>X>>Y;
	vp in(n);
	rep(i,n){
		int a,b;char d;
		pii c;
		cin>>a>>b>>d;
		if(d=='N')c={a,Y-b};
		if(d=='E')c={X+Y-b,X-a};
		if(d=='S')c={X+Y+X-a,b};
		if(d=='W')c={X+Y+X+b,a};
		int l=c.first-c.second,r=c.first+c.second;
		if(l<0)l+=X+X+Y+Y,r+=X+X+Y+Y;
		in[i]={r,l};
	}
	int out=inf;
//	rep(i,n)cout<<in[i].second<<" "<<in[i].first<<endl;
	rep(i,2*n){
		sort(all(in));
		int co=0;
		int mi=-1;
	//	rep(j,n)cout<<in[j].second<<" "<<in[j].first<<endl;
		rep(j,n){
			if(mi<in[j].second){
				mi=in[j].first;
				co++;
			}
//			cout<<mi<<" "<<co<<endl;
		}
//		if(co==6){
//			cout<<i<<endl;
//			rep(j,n)cout<<in[j].second<<" "<<in[j].first<<endl;
//			return 0;
//		}
		out=min(out,co);
		in.pb({in[0].first+X+X+Y+Y,in[0].second+X+X+Y+Y});
		in.erase(in.begin());
	}
	cout<<out<<endl;
}
```