/*
* =====================================================================================
*
* Filename: gym101047_F.cpp
*
* Description:
*
* Version: 1.0
* Created: 07/19/2016 05:59:53 PM
* Revision: none
* Compiler: gcc
*
* Author: prateepm
* Organization:
*
* =====================================================================================
*/
#include <bits/stdc++.h>
using namespace std;
#define LET(x,a) ::typeid(a) x(a)
#define IFOR(i,a,b) for(LET(i,a);i!=(b);++i)
#define EACH(it,v) IFOR(it,v.begin(),v.end())
#define FOR(i,a,b) for(int i = (a); i < int(b);i++)
#define REP(i,n) FOR(i,0,n)
#define SZ size()
#define PB push_back
#define PF push_front
#define V(x) vector< x >
#define two(X) (1<<(X))
#define twoL(X) (((int64)(1))<<(X))
#define contain(S,X) (((S)&two(X))!=0)
#define containL(S,X) (((S)&twoL(X))!=0
#define ALL(v) (v).begin(),(v).end()
const double pi=acos(-1.0);
const double eps=1e-11;
const int INFINITE=0x3f3f3f3f;
template<class T> inline void swap(T &a, T &b) { T temp = a; a = b; b = temp; }
template<class T> inline void checkmin(T &a,T b){if(b<a) a=b;}
template<class T> inline void checkmax(T &a,T b){if(b>a) a=b;}
template<class T> inline T sqr(T x){return x*x;}
typedef pair<int,int> ipair;
template<class T> inline T lowbit(T n){return (n^(n-1))&n;}
template<class T> inline int countbit(T n){return (n==0)?0:(1+countbit(n&(n-1)));}
template<class T> inline T gcd(T a, T b) { T c; while ( a != 0 ) { c = a; a = b%a; b = c; } return b;}
// iff gcd(a,b) == 1
template<class T> inline T inv(T a, T b) { return 1 < a ? b - inv(b%a,a) * b / a : 1; }
typedef V(int) VI;
typedef V(VI) VII;
typedef V(string) VS;
typedef long long int64;
typedef long double LD;
typedef pair<int,int> PI;
//#define LocalHost
const int MAXN = 2011;
const int64 MAXV = (int64) 1e16 + 1LL;
int64 dp[MAXN][MAXN];
short vis[MAXN][MAXN];
pair<int, pair<int64,int64> > raj[MAXN];
bool cmp(pair<int, pair<int64, int64> > a, pair<int, pair<int64, int64> > b)
{
if (a.second.first != b.second.first) return (a.second.first < b.second.first);
else if (a.second.second != b.second.second) return (a.second.second > b.second.second);
else return (a.first < b.first);
}
inline int64 doit(int pos, int sp, int64 st, int n)
{
if(pos == n) return st;
if (vis[pos][sp]) {
return dp[pos][sp];
}
int64 t0 = MAXV, t1 = t0;
if(st > raj[pos].second.first) {
t0 = doit(pos+1,sp,st+raj[pos].second.second - raj[pos].second.first,n);
}
if(sp > 0) t1 = doit(pos+1,sp-1,st,n);
if (t1 < t0) {
--sp;
dp[pos][sp] = t1;
}
else if(t0 < MAXV) dp[pos][sp] = t0;
else dp[pos][sp] = MAXV;
vis[pos][sp] = 1;
return dp[pos][sp];
}
inline int solve(int testnum)
{
REP(i, 2001) REP(j, 2001) {
dp[i][j] = MAXV;
vis[i][j] = 0;
}
int n, k; int64 h; cin >> n >> h >> k;
REP(i, n) {
raj[i].first = i;
cin >> raj[i].second.first >> raj[i].second.second;
}
sort(raj, raj + n, cmp);
doit(0, k, h, n);
REP(sp, k + 1) if (dp[0][sp] < MAXV) {
printf("Y\n");
return 0;
}
printf("N\n");
return 0;
}
int main(int argc, char* argv[])
{
#ifdef LocalHost
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
#endif
ios::sync_with_stdio( false);
int t = 1; cin >> t;
if(argc > 1) t = atoi(argv[1]);
FOR(_t,1,t+1) {
int ret = solve(_t);
if(ret == -1) break;
}
#ifdef LocalHost
printf("Time taken : %.10f seconds\n", (1.0f*clock()) / CLOCKS_PER_SEC);
#endif
return 0;
}
LyoKICogPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PQogKgogKiAgICAgICBGaWxlbmFtZTogIGd5bTEwMTA0N19GLmNwcAogKgogKiAgICBEZXNjcmlwdGlvbjogIAogKgogKiAgICAgICAgVmVyc2lvbjogIDEuMAogKiAgICAgICAgQ3JlYXRlZDogIDA3LzE5LzIwMTYgMDU6NTk6NTMgUE0KICogICAgICAgUmV2aXNpb246ICBub25lCiAqICAgICAgIENvbXBpbGVyOiAgZ2NjCiAqCiAqICAgICAgICAgQXV0aG9yOiAgcHJhdGVlcG0gCiAqICAgT3JnYW5pemF0aW9uOiAgCiAqCiAqID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0KICovCgoKI2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+Cgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKI2RlZmluZSBMRVQoeCxhKSAgICAgICAgOjp0eXBlaWQoYSkgeChhKQojZGVmaW5lIElGT1IoaSxhLGIpICAgICBmb3IoTEVUKGksYSk7aSE9KGIpOysraSkKI2RlZmluZSBFQUNIKGl0LHYpICAgICAgSUZPUihpdCx2LmJlZ2luKCksdi5lbmQoKSkKI2RlZmluZSBGT1IoaSxhLGIpICAgICAgZm9yKGludCBpID0gKGEpOyBpIDwgaW50KGIpO2krKykKI2RlZmluZSBSRVAoaSxuKSAgICAgICAgRk9SKGksMCxuKQojZGVmaW5lIFNaICAgICAgICAgICAgICBzaXplKCkKI2RlZmluZSBQQiAgICAgICAgICAgICAgcHVzaF9iYWNrCiNkZWZpbmUgUEYgICAgICAgICAgICAgIHB1c2hfZnJvbnQKI2RlZmluZSBWKHgpICAgICAgICAgICAgdmVjdG9yPCB4ID4KI2RlZmluZSB0d28oWCkgICAgICAgICAgKDE8PChYKSkKI2RlZmluZSB0d29MKFgpICAgICAgICAgKCgoaW50NjQpKDEpKTw8KFgpKQojZGVmaW5lIGNvbnRhaW4oUyxYKSAgICAoKChTKSZ0d28oWCkpIT0wKQojZGVmaW5lIGNvbnRhaW5MKFMsWCkgICAoKChTKSZ0d29MKFgpKSE9MAojZGVmaW5lIEFMTCh2KSAgICAgICAgICAodikuYmVnaW4oKSwodikuZW5kKCkKCmNvbnN0IGRvdWJsZSBwaT1hY29zKC0xLjApOwpjb25zdCBkb3VibGUgZXBzPTFlLTExOwpjb25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