#include<bits/stdc++.h>
using namespace std;#definelll__int128#defineendl'\n'typedeflonglong ll;typedefunsignedlonglong ull;typedef pair<ll, ll> PII;constint mod =1e9+7;inline ll read(){
ll x =0, y =1;char c =getchar();while(!isdigit(c)){if(c =='-')
y =-1;
c =getchar();}while(isdigit(c)){
x =(x <<3)+(x <<1)+(c ^48);
c =getchar();}return x *= y;}inlinevoidwrite(ll x){if(x <0)
x =-x,putchar('-');
ll sta[35], top =0;do
sta[top++]= x %10, x /=10;while(x);while(top)putchar(sta[--top]+'0');}voidMiraitowa(){
string s;
cin >> s;
cout << s[0]-'0'+ s[1]-'0'<< endl;}intmain(){
ios::sync_with_stdio(false);
cin.tie(0), cout.tie(0);int t;
cin>>t;while(t--)Miraitowa();return0;};
#include<bits/stdc++.h>
using namespace std;#definelll__int128#defineendl'\n'typedeflonglong ll;typedefunsignedlonglong ull;typedef pair<ll, ll> PII;constint mod =1e9+7;inline ll read(){
ll x =0, y =1;char c =getchar();while(!isdigit(c)){if(c =='-')
y =-1;
c =getchar();}while(isdigit(c)){
x =(x <<3)+(x <<1)+(c ^48);
c =getchar();}return x *= y;}inlinevoidwrite(ll x){if(x <0)
x =-x,putchar('-');
ll sta[35], top =0;do
sta[top++]= x %10, x /=10;while(x);while(top)putchar(sta[--top]+'0');}constint N =3e5+10;
PII a[N];voidMiraitowa(){
ll n, s, m;
cin >> n >> s >> m;for(int i =1; i <= n; i++)
cin >> a[i].first >> a[i].second;sort(a +1, a +1+ n);
ll res =0, j =0;for(int i =1; i <= n; i++)
res =max(res, a[i].first - j), j = a[i].second;
res =max(res, m - a[n].second);if(res >= s)
cout <<"Yes"<< endl;else
cout <<"No"<< endl;}intmain(){
ios::sync_with_stdio(false);
cin.tie(0), cout.tie(0);int t;
cin >> t;while(t--)Miraitowa();return0;};
#include<bits/stdc++.h>
using namespace std;#definelll__int128#defineendl'\n'typedeflonglong ll;typedefunsignedlonglong ull;typedef pair<ll, ll> PII;constint mod =1e9+7;inline ll read(){
ll x =0, y =1;char c =getchar();while(!isdigit(c)){if(c =='-')
y =-1;
c =getchar();}while(isdigit(c)){
x =(x <<3)+(x <<1)+(c ^48);
c =getchar();}return x *= y;}inlinevoidwrite(ll x){if(x <0)
x =-x,putchar('-');
ll sta[35], top =0;do
sta[top++]= x %10, x /=10;while(x);while(top)putchar(sta[--top]+'0');}constint N =3e5+10;
PII a[N];voidMiraitowa(){
string s, t;
cin >> s >> t;int cnt =0;for(int i =0; i < s.size();i++){if(cnt>=t.size())continue;if(s[i]== t[cnt]) cnt++;else{if(s[i]=='?') s[i]= t[cnt], cnt++;}}for(int i =0; i < s.size();i++)if(s[i]=='?') s[i]='a';if(cnt>=t.size()){
cout <<"YES"<< endl;
cout << s << endl;}else cout <<"NO"<< endl;}intmain(){
ios::sync_with_stdio(false);
cin.tie(0), cout.tie(0);int t;
cin >> t;while(t--)Miraitowa();return0;};
#include<bits/stdc++.h>
using namespace std;#definelll__int128#defineendl'\n'typedeflonglong ll;typedefunsignedlonglong ull;typedef pair<ll,ll> PII;constint mod=1e9+7;inline ll read(){
ll x =0, y =1;char c =getchar();while(!isdigit(c)){if(c =='-')
y =-1;
c =getchar();}while(isdigit(c)){
x =(x <<3)+(x <<1)+(c ^48);
c =getchar();}return x *= y;}inlinevoidwrite(ll x){if(x <0)
x =-x,putchar('-');
ll sta[35], top =0;do
sta[top++]= x %10, x /=10;while(x);while(top)putchar(sta[--top]+'0');}constint N=3e5+10;
ll a[N];voidMiraitowa(){int l, r;
cin >> l >> r;
cout << a[r]- a[l -1]+ a[l]- a[l -1]<< endl;}intmain(){
ios::sync_with_stdio(false);
cin.tie(0),cout.tie(0);for(int i =1; i < N;i++){int x = i, cnt =0;while(x) x /=3, cnt++;
a[i]= cnt;}for(int i =1; i < N;i++)
a[i]+= a[i -1];int t;
cin >> t;while(t--)Miraitowa();return0;};
#include<bits/stdc++.h>
using namespace std;#definelll__int128#defineendl'\n'typedeflonglong ll;typedefunsignedlonglong ull;typedef pair<ll,ll> PII;constint mod=1e9+7;inline ll read(){
ll x =0, y =1;char c =getchar();while(!isdigit(c)){if(c =='-')
y =-1;
c =getchar();}while(isdigit(c)){
x =(x <<3)+(x <<1)+(c ^48);
c =getchar();}return x *= y;}inlinevoidwrite(ll x){if(x <0)
x =-x,putchar('-');
ll sta[35], top =0;do
sta[top++]= x %10, x /=10;while(x);while(top)putchar(sta[--top]+'0');}constint N =3e5+10;
ll fact[N], infact[N];
ll qmi(ll a,ll b){
ll res =1;while(b){if(b&1) res = res * a % mod;
b >>=1;
a = a * a % mod;}return res;}
ll C(ll a,ll b){return fact[a]* infact[b]% mod * infact[a - b]% mod;}voidMiraitowa(){
ll cnt1=0, cnt2=0;
ll n, k;
cin >> n >> k;for(int i =1; i <= n;i++){
ll x;
cin >> x;if(x==1) cnt1++;else cnt2++;}
ll res =0;for(int i = k /2+1; i <= k;i++){int j = k - i;if(i>cnt1)continue;if(j>cnt2)continue;
res=(res+C(cnt1,i)*C(cnt2,j)%mod)%mod;}
cout << res << endl;}intmain(){
ios::sync_with_stdio(false);
cin.tie(0),cout.tie(0);
fact[0]= infact[0]=1;for(int i =1; i < N;i++){
fact[i]= fact[i -1]* i % mod;
infact[i]= infact[i -1]*qmi(i, mod -2)% mod;}int t;
cin >> t;while(t--)Miraitowa();return0;};
#include<bits/stdc++.h>
using namespace std;#definelll__int128typedeflonglong ll;typedefunsignedlonglong ull;typedef pair<ll, ll> PII;constint mod =1e9+7;inline ll read(){
ll x =0, y =1;char c =getchar();while(!isdigit(c)){if(c =='-')
y =-1;
c =getchar();}while(isdigit(c)){
x =(x <<3)+(x <<1)+(c ^48);
c =getchar();}return x *= y;}inlinevoidwrite(ll x){if(x <0)
x =-x,putchar('-');
ll sta[35], top =0;do
sta[top++]= x %10, x /=10;while(x);while(top)putchar(sta[--top]+'0');}
ll query(ll a, ll b){
std::cout <<"? "<< a <<" "<< b << std::endl;int res;
std::cin >> res;return res;}voidsolve(){
ll lo =2, hi =999;while(lo < hi){
ll x =(lo + hi)/2;if(query(1, x)== x +1){
hi = x;}else{
lo = x +1;}}
std::cout <<"! "<< lo << std::endl;}intmain(){
ios::sync_with_stdio(false);
cin.tie(0), cout.tie(0);int t;
cin >> t;while(t--)solve();return0;};
#include<bits/stdc++.h>
using namespace std;#definelll__int128typedeflonglong ll;typedefunsignedlonglong ull;typedef pair<ll, ll> PII;constint mod =1e9+7;inline ll read(){
ll x =0, y =1;char c =getchar();while(!isdigit(c)){if(c =='-')
y =-1;
c =getchar();}while(isdigit(c)){
x =(x <<3)+(x <<1)+(c ^48);
c =getchar();}return x *= y;}inlinevoidwrite(ll x){if(x <0)
x =-x,putchar('-');
ll sta[35], top =0;do
sta[top++]= x %10, x /=10;while(x);while(top)putchar(sta[--top]+'0');}intquery(int a,int b){
std::cout <<"? "<< a <<" "<< b << std::endl;int res;
std::cin >> res;return res;}voidsolve(){int lo =1, hi =999;while(hi - lo >1){int x = lo +(hi - lo)/3;int y = lo +(hi - lo)*2/3;int res =query(x, y);if(res == x * y){
lo = y;}elseif(res == x *(y +1)){
lo = x;
hi = y;}else{assert(res ==(x +1)*(y +1));
hi = x;}}
std::cout <<"! "<< hi << std::endl;}intmain(){
ios::sync_with_stdio(false);
cin.tie(0), cout.tie(0);int t;
cin >> t;while(t--)solve();return0;};