#include<bits/stdc++.h>
using namespace std;
int t,x,n,m;
int main(){
	cin>>t;
	while(t--)
	{
		x=n=m=0;
		cin>>x>>n>>m;
		while(x>=20&&n--)
		    x=x/2+10;
		while(x>0&&m--)
		    x-=10;
		if(x<=0)
		    cout<<"YES";
		else
		    cout<<"NO";
		cout<<"\n";
	}
	return 0;
}


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

int main() {
    int t;
    cin>>t;
    int x,n,m;
    while(t--) {
        cin>>x>>n>>m;
        if(x<=20) {
            if(x<=10*m) {
                cout<<"Yes"<<endl;
            } else {
                cout<<"NO"<<endl;
            }
        } else {
            for(int i=0;i<n;i++) {
                if(x<=20) {
                    break;
                } else {
                    x = x/2+10;
                }
            }
            if(x<=10*m) {
                cout<<"YES"<<endl;
            } else {
                cout<<"NO"<<endl;
            }
        }
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int x, n, m;

int main()
{
    int T;
    for (scanf("%d", &T); T--;)
    {
        scanf("%d%d%d", &x, &n, &m);
        for (int i = 1; i <= n; i++)
            x = min(x, (x >> 1) + 10);
        x -= m * 10;
        puts(x <= 0 ? "YES" : "NO");
    }
}


#include <stdio.h>
#include <iostream>
#include <string>
#include <string.h>
#include <math.h>
#include <ctype.h>
#include <functional>
#include <stdlib.h>
#include <algorithm>
using namespace std;
int main()
{
	int t, i, j; scanf("%d", &t);
	for (i = 0; i < t; i++)
	{
		int x, n, m; scanf("%d%d%d", &x, &n, &m);
		int ln = n, lm = m, p = ln + lm, con1, con2, mx;
		while (p)
		{
			con1 = x / 2 - 10; con2 = 10;
			if (ln == 0)
			{
				mx = con2; lm--;
			}
			else if (lm == 0)
			{
				mx = con1; ln--;
			}
			else
			{
				if (con2 > con1)
				{
					mx = con2; lm--;
				}
				else
				{
					mx = con1; ln--;
				}
			}
			x -= mx; p--;
			if (x <= 0) break;
		}
		if (x > 0) printf("NO");
		else printf("YES");
		if (i != t - 1) printf("\n");
	}
}


#include<bits/stdc++.h>
#define int long long
using namespace std;
inline int read()
{
    char ch=getchar();
    int x=0;
    while(ch<'0'||ch>'9') ch=getchar();
    while(ch>='0'&&ch<='9') x=x*10+ch-48,ch=getchar();
    return x;
}
int n,x,m;
signed main() {
    int T=read();
    while(T--) {
        x=read();
        n=read();
        m=read();
        while(n&&x>20) {
            x=x/2+10;
            n--;
        }
        if(m*10>=x) puts("Yes"); else puts("No");
    }
    return 0;
}


#include<iostream>
using namespace std;
int t,x,m,n;
int main(){
	cin >> t;
	for(int i=0;i<t;i++){
		x=0;
		m=0;
		n=0;
		cin >> x >> m >> n;
		while(x>=20&&m--){
			x=x/2+10;
		}
		while(x>0&&n--){
			x-=10;
		}
		if(x==0)cout << "YES" << endl;
		else cout << "NO" << endl;
	}
	return 0;
}


#include<cstdio>

int n,m,x,t;
int main()
{
	scanf("%d",&t);
	for(int i=1;i<=t;++i)
	{
		scanf("%d%d%d",&x,&n,&m);
		for(int j=1;j<=n&&x>20;++j)
		{
			x/=2;
			x+=10;
		}
		m*=10;
		if(x<=m) puts("YES");
		else puts("NO");
	}
	return 0x0;
}


#include<stdio.h>
#include<math.h>
#include<string.h>
#include<queue>
#include<algorithm>
#include<vector>
using namespace std;
int main()
{
    int m,n,a,b;
    int t;
    scanf("%d",&t);
    while(t--)
    {
        scanf("%d%d%d",&n,&a,&b);
        while(n>20&&a)
        {
//            if(n%2)
//                n=n/2+1;
//            else
                n/=2;
            n+=10;
            a--;
        }
//        printf("%d\n",n);
//        printf("%d\n",a);
        n=n-b*10;
        if(n<=0)
            puts("YES");
        else
            puts("NO");
    }
    return 0;

}


#include <iostream>

using namespace std;
int main()
{
    int t;
    cin >> t;
    while (t--)
    {
        int x, n, m;
        cin >> x >> n >> m;
        while (x > 0)
        {
            if (n > 0 && m > 0)
            {
                if (x / 2 + 10 > x)
                {
                    x = x - 10;
                    m--;
                }
                else
                {
                    x = x / 2 + 10;
                    n--;
                }
            }
            else if (n > 0 && m == 0)
            {
                x = x / 2 + 10;
                n--;
            }
            else if (n == 0 && m > 0)
            {
                x -= 10;
                m--;
            }
            else if (m == 0 && n == 0)
                break;
        }
        if (x > 0)
            cout << "NO" << endl;
        else cout << "YES" << endl;
    }
}


#include<cstdio>
int t,x,a,b;
inline int r(){
	int o=0;char c=getchar();
	while(c>57||c<48)	c=getchar();
	while(c>47&&c<58)	o=(o<<1)+(o<<3)+(c^48),c=getchar();
	return o;
}
int main(){
	t=r();
	while(t--){
		x=r();a=r();b=r();
		while(x>20&&a--)	x=x/2+10;
		puts(x<=b*10?"YES":"NO");
	}
	return 0;
}


#include<iostream>
using namespace std;
int main(){
	int T;
	cin>>T;
	for(int i=0;i<T;i++){
		int x,m,n;
		cin>>x>>n>>m;
		while(x>=20&&n!=0){
			x=x/2+10;
			n--;
		}
		while(x>0 &&m!=0){
			x=x-10;
			m--;
		}
		if(x>0) cout<<"NO"<<endl;
		else cout<<"YES"<<endl;
	}
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
	int t;
	cin>>t;
	while(t--)
	{
		int x,n,m;
		scanf("%d%d%d",&x,&n,&m);
		for(int i=0;i<n;i++)
		{
			x=x/2+10;
			if(x<=20)break;
		}
		if(x>10*m)cout<<"No"<<endl;
		else cout<<"Yes"<<endl;
	}
}


#include<iostream>
using namespace std;
int t,x,m,n;
int main(){
	cin >> t;
	for(int i=0;i<t;i++){
		cin >> x >> m >> n;
		while(x>=20&&m--){
			x=x/2+10;
		}
		while(x>0&&n--){
			x-=10;
		}
		if(x==0)cout << "YES" << endl;
		else cout << "NO" << endl;
	}
	return 0;
}


#include<iostream>
using namespace std;
int t,x,m,n;
int main(){
	cin >> t;
	while(t--){
		x=0;
		m=0;
		n=0;
		cin >> x >> m >> n;
		while(x>=20&&m--){
			x=x/2+10;
		}
		while(x>0&&n--){
			x-=10;
		}
		if(x<=0)cout << "YES" << endl;
		else cout << "NO" << endl;
	}
	return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
int t,x,m,n;

int main()
{
	scanf("%d",&t);
	while(t--)
	{
		scanf("%d%d%d",&x,&n,&m);
		while(x>20&&n--) x=x/2+10;
		while(x>0&&m--) x-=10;
		if(x<=0) cout<<"YES"<<endl;
		else cout<<"No"<<endl;
	}
	return 0;
}


#include<iostream>
#include<cstring>
#include<cstdio>
#include<vector>
#include<queue>
#include<ctime>
#include<cmath>
#include<algorithm>

using namespace std;

#define LL long long
#define fgx cerr<<"------------------"<<endl;
#define dgx cerr<<"=================="<<endl;
#define prt(x) cerr<<#x<<": "<<x<<endl;

inline int read(){
	int x=0,f=1;char c=getchar();
	for(;!isdigit(c);c=getchar()) if(c=='-') f=-1;
	for(;isdigit(c);c=getchar()) x=x*10+c-'0';
	return x*f;
}
const int MAXN = 200010;

inline void solve(){
	int x=read(),N=read(),M=read();
	while(N--&&x/2+10<=x) x=x/2+10;
	if(x<=M*10) printf("YES\n"); else printf("NO\n");
}

int main(){
	for(int Cas=read();Cas>=1;Cas--) solve();
	return 0;
}


#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;

const int MAXN=35;
int x,n,m;
int f[MAXN][MAXN];

bool solve(void)
{
	f[0][0]=x;
	for(int i=1;i<=n;i++)
	 f[i][0]=f[i-1][0]/2+10;
	for(int i=1;i<=m;i++)
	 f[0][i]=f[0][i-1]-10;
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=m;j++)
		{
			f[i][j]=min(f[i-1][j]/2+10,f[i][j-1]-10);
		}
	}
	for(int i=0;i<=n;i++)
	 for(int j=0;j<=m;j++)
	  if(f[i][j]<=0)
	   return true;
	return false;
}

int main()
{
    ios_base::sync_with_stdio(false);
    int T;cin>>T;
    while(T--)
    {
    	cin>>x>>n>>m;
    	cout<<(solve()?"YES":"NO")<<endl;
	}
	return 0;
}


#include<bits/stdc++.h>
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define pb push_back
typedef long long ll;
const ll inf=132913423200339;
const ll mod=998244353676776;
const int N=2e5+2;
const ll M=1e9;
const double eps=1e-7;
using namespace std;
ll gcd(ll a,ll b) {return b==0?a:gcd(b,a%b);}
ll lcm(ll a,ll b) { return a*b/gcd(a,b);    }
ll qp(ll a,ll b, ll p){ll ans = 1;while(b){if(b&1){ans = (ans*a)%p;--b;}a = (a*a)%p;b >>= 1;}return ans%p;}
ll Inv(ll x)          { return qp(x,mod-2,mod);}
ll C(ll n,ll m){if (m>n) return 0;ll ans = 1;for (int i = 1; i <= m; ++i) ans=ans*Inv(i)%mod*(n-i+1)%mod;return ans%mod;}
ll A(ll n,ll m,ll mod){ll sum=1; for(int i=n;i>=n-m+1;i--) sum=(sum*i)%mod; return sum%mod;}
ll lowbit(ll x) {return x&(-x);}
ll c[N],sum1[N],sum2[N],b[N],lsh[N],n,m,fa[13],a[N];
void add1(ll i,ll k){ while(i<=n) {c[i]+=k;i+=lowbit(i);}}//预处理ai单点修改 区间查询***预处理a[i]-a[i-1]区间修改单点查询
ll  Sum1(ll i) {ll res=0; while(i>0) res+=c[i],i-=lowbit(i);return res;}//预处理ai单点修改 区间查询***预处理a[i]-a[i-1]区间修改单点查询
void add2(ll i,ll k){ ll x=i;while(i<=n) {sum1[i]+=k;sum2[i]+=k*(x-1);i+=lowbit(i);}}//区间修改,区间查询
ll  Sum2(ll i) {ll res=0,x=i;while(i>0){ res+= x * sum1[i]-sum2[i]; i -= lowbit(i);}return res;}//区间修改,区间查询
void ls(){ll cnt; for(ll i=1;i<=n;i++) lsh[i]=a[i]; sort(lsh+1,lsh+n+1);cnt = unique(lsh+1,lsh+n+1)-lsh-1; for(int i=1;i<=n;i++)a[i]=lower_bound(lsh+1,lsh+cnt+1,a[i])-lsh;}
ll lca(ll x) { if(x==fa[x]) return x;else return fa[x]=lca(fa[x]); }//找祖先.
int main()
{
    int t,x,n1,m1;
    cin>>t;
    while(t--)
    {
        cin>>x>>n1>>m1;
        while(1)
        {
            if(n1&&x>20)
            {
                n1--;
                x=x/2+10;
            }
            else
            {
                m1--;
                x-=10;
            }
            if(x<=0||(n1<=0&&m1<=0)) break;
        }
        if(x<=0) cout<<"YES"<<endl;
        else     cout<<"NO"<<endl;
    }
    return 0;
}


#include<bits/stdc++.h>
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define pb push_back
typedef long long ll;
const ll inf=132913423200339;
const ll mod=998244353676776;
const int N=2e5+2;
const ll M=1e9;
const double eps=1e-7;
using namespace std;
ll gcd(ll a,ll b) {return b==0?a:gcd(b,a%b);}
ll lcm(ll a,ll b) { return a*b/gcd(a,b);    }
ll qp(ll a,ll b, ll p){ll ans = 1;while(b){if(b&1){ans = (ans*a)%p;--b;}a = (a*a)%p;b >>= 1;}return ans%p;}
ll Inv(ll x)          { return qp(x,mod-2,mod);}
ll C(ll n,ll m){if (m>n) return 0;ll ans = 1;for (int i = 1; i <= m; ++i) ans=ans*Inv(i)%mod*(n-i+1)%mod;return ans%mod;}
ll A(ll n,ll m,ll mod){ll sum=1; for(int i=n;i>=n-m+1;i--) sum=(sum*i)%mod; return sum%mod;}
ll lowbit(ll x) {return x&(-x);}
ll c[N],sum1[N],sum2[N],b[N],lsh[N],n,m,fa[13],a[N];
void add1(ll i,ll k){ while(i<=n) {c[i]+=k;i+=lowbit(i);}}//预处理ai单点修改 区间查询***预处理a[i]-a[i-1]区间修改单点查询
ll  Sum1(ll i) {ll res=0; while(i>0) res+=c[i],i-=lowbit(i);return res;}//预处理ai单点修改 区间查询***预处理a[i]-a[i-1]区间修改单点查询
void add2(ll i,ll k){ ll x=i;while(i<=n) {sum1[i]+=k;sum2[i]+=k*(x-1);i+=lowbit(i);}}//区间修改,区间查询
ll  Sum2(ll i) {ll res=0,x=i;while(i>0){ res+= x * sum1[i]-sum2[i]; i -= lowbit(i);}return res;}//区间修改,区间查询
void ls(){ll cnt; for(ll i=1;i<=n;i++) lsh[i]=a[i]; sort(lsh+1,lsh+n+1);cnt = unique(lsh+1,lsh+n+1)-lsh-1; for(int i=1;i<=n;i++)a[i]=lower_bound(lsh+1,lsh+cnt+1,a[i])-lsh;}
ll lca(ll x) { if(x==fa[x]) return x;else return fa[x]=lca(fa[x]); }//找祖先.
int main()
{
    int t,x,n1,m1;
    cin>>t;
    while(t--)
    {
        cin>>x>>n1>>m1;
        while(n1||m1)
        {
            if(n1&&x>20)
            {
                n1--;
                x=x/2+10;
            }
            else
            {
                m1--;
                x-=10;
            }
            if(x<=0) break;
        }
        if(x<=0) cout<<"YES"<<endl;
        else     cout<<"NO"<<endl;
    }
    return 0;
}


#include<bits/stdc++.h>
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define pb push_back
typedef long long ll;
const ll inf=132913423200339;
const ll mod=998244353676776;
const int N=2e5+2;
const ll M=1e9;
const double eps=1e-7;
using namespace std;
ll gcd(ll a,ll b) {return b==0?a:gcd(b,a%b);}
ll lcm(ll a,ll b) { return a*b/gcd(a,b);    }
ll qp(ll a,ll b, ll p){ll ans = 1;while(b){if(b&1){ans = (ans*a)%p;--b;}a = (a*a)%p;b >>= 1;}return ans%p;}
ll Inv(ll x)          { return qp(x,mod-2,mod);}
ll C(ll n,ll m){if (m>n) return 0;ll ans = 1;for (int i = 1; i <= m; ++i) ans=ans*Inv(i)%mod*(n-i+1)%mod;return ans%mod;}
ll A(ll n,ll m,ll mod){ll sum=1; for(int i=n;i>=n-m+1;i--) sum=(sum*i)%mod; return sum%mod;}
ll lowbit(ll x) {return x&(-x);}
ll c[N],sum1[N],sum2[N],b[N],lsh[N],n,m,fa[13],a[N];
void add1(ll i,ll k){ while(i<=n) {c[i]+=k;i+=lowbit(i);}}//预处理ai单点修改 区间查询***预处理a[i]-a[i-1]区间修改单点查询
ll  Sum1(ll i) {ll res=0; while(i>0) res+=c[i],i-=lowbit(i);return res;}//预处理ai单点修改 区间查询***预处理a[i]-a[i-1]区间修改单点查询
void add2(ll i,ll k){ ll x=i;while(i<=n) {sum1[i]+=k;sum2[i]+=k*(x-1);i+=lowbit(i);}}//区间修改,区间查询
ll  Sum2(ll i) {ll res=0,x=i;while(i>0){ res+= x * sum1[i]-sum2[i]; i -= lowbit(i);}return res;}//区间修改,区间查询
void ls(){ll cnt; for(ll i=1;i<=n;i++) lsh[i]=a[i]; sort(lsh+1,lsh+n+1);cnt = unique(lsh+1,lsh+n+1)-lsh-1; for(int i=1;i<=n;i++)a[i]=lower_bound(lsh+1,lsh+cnt+1,a[i])-lsh;}
ll lca(ll x) { if(x==fa[x]) return x;else return fa[x]=lca(fa[x]); }//找祖先.
int main()
{
    int t,x,n1,m1;
    cin>>t;
    while(t--)
    {
        cin>>x>>n1>>m1;
        while(n1||m1)
        {
            if((x/2+10<x-10)&&n1&&m1!=1)
            {
                n1--;
                x=x/2+10;
            }
            else
            {
                m1--;
                x-=10;
            }
            if(x<=0) break;
        }
       // cout<<x<<endl;
        if(x<=0) cout<<"YES"<<endl;
        else     cout<<"NO"<<endl;
    }
    return 0;
}


#include<bits/stdc++.h>
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define pb push_back
typedef long long ll;
const ll inf=132913423200339;
const ll mod=998244353676776;
const int N=2e5+2;
const ll M=1e9;
const double eps=1e-7;
using namespace std;
ll gcd(ll a,ll b) {return b==0?a:gcd(b,a%b);}
ll lcm(ll a,ll b) { return a*b/gcd(a,b);    }
ll qp(ll a,ll b, ll p){ll ans = 1;while(b){if(b&1){ans = (ans*a)%p;--b;}a = (a*a)%p;b >>= 1;}return ans%p;}
ll Inv(ll x)          { return qp(x,mod-2,mod);}
ll C(ll n,ll m){if (m>n) return 0;ll ans = 1;for (int i = 1; i <= m; ++i) ans=ans*Inv(i)%mod*(n-i+1)%mod;return ans%mod;}
ll A(ll n,ll m,ll mod){ll sum=1; for(int i=n;i>=n-m+1;i--) sum=(sum*i)%mod; return sum%mod;}
ll lowbit(ll x) {return x&(-x);}
ll c[N],sum1[N],sum2[N],b[N],lsh[N],n,m,fa[13],a[N];
void add1(ll i,ll k){ while(i<=n) {c[i]+=k;i+=lowbit(i);}}//预处理ai单点修改 区间查询***预处理a[i]-a[i-1]区间修改单点查询
ll  Sum1(ll i) {ll res=0; while(i>0) res+=c[i],i-=lowbit(i);return res;}//预处理ai单点修改 区间查询***预处理a[i]-a[i-1]区间修改单点查询
void add2(ll i,ll k){ ll x=i;while(i<=n) {sum1[i]+=k;sum2[i]+=k*(x-1);i+=lowbit(i);}}//区间修改,区间查询
ll  Sum2(ll i) {ll res=0,x=i;while(i>0){ res+= x * sum1[i]-sum2[i]; i -= lowbit(i);}return res;}//区间修改,区间查询
void ls(){ll cnt; for(ll i=1;i<=n;i++) lsh[i]=a[i]; sort(lsh+1,lsh+n+1);cnt = unique(lsh+1,lsh+n+1)-lsh-1; for(int i=1;i<=n;i++)a[i]=lower_bound(lsh+1,lsh+cnt+1,a[i])-lsh;}
ll lca(ll x) { if(x==fa[x]) return x;else return fa[x]=lca(fa[x]); }//找祖先.
int main()
{
    int t,x,n1,m1;
    cin>>t;
    while(t--)
    {
        cin>>x>>n1>>m1;
        while(n1||m1)
        {
            if((x/10+10<x-10)&&n1&&m1!=1)
            {
                n1--;
                x=x/2+10;
            }
            else
            {
                m1--;
                x-=10;
            }
            if(x<=0) break;
        }
       // cout<<x<<endl;
        if(x<=0) cout<<"YES"<<endl;
        else     cout<<"NO"<<endl;
    }
    return 0;
}


#include<bits/stdc++.h>
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define pb push_back
typedef long long ll;
const ll inf=132913423200339;
const ll mod=998244353676776;
const int N=2e5+2;
const ll M=1e9;
const double eps=1e-7;
using namespace std;
ll gcd(ll a,ll b) {return b==0?a:gcd(b,a%b);}
ll lcm(ll a,ll b) { return a*b/gcd(a,b);    }
ll qp(ll a,ll b, ll p){ll ans = 1;while(b){if(b&1){ans = (ans*a)%p;--b;}a = (a*a)%p;b >>= 1;}return ans%p;}
ll Inv(ll x)          { return qp(x,mod-2,mod);}
ll C(ll n,ll m){if (m>n) return 0;ll ans = 1;for (int i = 1; i <= m; ++i) ans=ans*Inv(i)%mod*(n-i+1)%mod;return ans%mod;}
ll A(ll n,ll m,ll mod){ll sum=1; for(int i=n;i>=n-m+1;i--) sum=(sum*i)%mod; return sum%mod;}
ll lowbit(ll x) {return x&(-x);}
ll c[N],sum1[N],sum2[N],b[N],lsh[N],n,m,fa[13],a[N];
void add1(ll i,ll k){ while(i<=n) {c[i]+=k;i+=lowbit(i);}}//预处理ai单点修改 区间查询***预处理a[i]-a[i-1]区间修改单点查询
ll  Sum1(ll i) {ll res=0; while(i>0) res+=c[i],i-=lowbit(i);return res;}//预处理ai单点修改 区间查询***预处理a[i]-a[i-1]区间修改单点查询
void add2(ll i,ll k){ ll x=i;while(i<=n) {sum1[i]+=k;sum2[i]+=k*(x-1);i+=lowbit(i);}}//区间修改,区间查询
ll  Sum2(ll i) {ll res=0,x=i;while(i>0){ res+= x * sum1[i]-sum2[i]; i -= lowbit(i);}return res;}//区间修改,区间查询
void ls(){ll cnt; for(ll i=1;i<=n;i++) lsh[i]=a[i]; sort(lsh+1,lsh+n+1);cnt = unique(lsh+1,lsh+n+1)-lsh-1; for(int i=1;i<=n;i++)a[i]=lower_bound(lsh+1,lsh+cnt+1,a[i])-lsh;}
ll lca(ll x) { if(x==fa[x]) return x;else return fa[x]=lca(fa[x]); }//找祖先.
int main()
{
    int t,x,n1,m1;
    cin>>t;
    while(t--)
    {
        cin>>x>>n1>>m1;
        while(n1||m1)
        {
            if((n1)
            {
                n1--;
                x=x/2+10;
            }
            else
            {
                m1--;
                x-=10;
            }
            if(x<=0) break;
        }
        if(x<=0) cout<<"YES"<<endl;
        else     cout<<"NO"<<endl;
    }
    return 0;
}


#include<bits/stdc++.h>
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define pb push_back
typedef long long ll;
const ll inf=132913423200339;
const ll mod=998244353676776;
const int N=2e5+2;
const ll M=1e9;
const double eps=1e-7;
using namespace std;
ll gcd(ll a,ll b) {return b==0?a:gcd(b,a%b);}
ll lcm(ll a,ll b) { return a*b/gcd(a,b);    }
ll qp(ll a,ll b, ll p){ll ans = 1;while(b){if(b&1){ans = (ans*a)%p;--b;}a = (a*a)%p;b >>= 1;}return ans%p;}
ll Inv(ll x)          { return qp(x,mod-2,mod);}
ll C(ll n,ll m){if (m>n) return 0;ll ans = 1;for (int i = 1; i <= m; ++i) ans=ans*Inv(i)%mod*(n-i+1)%mod;return ans%mod;}
ll A(ll n,ll m,ll mod){ll sum=1; for(int i=n;i>=n-m+1;i--) sum=(sum*i)%mod; return sum%mod;}
ll lowbit(ll x) {return x&(-x);}
ll c[N],sum1[N],sum2[N],b[N],lsh[N],n,m,fa[13],a[N];
void add1(ll i,ll k){ while(i<=n) {c[i]+=k;i+=lowbit(i);}}//预处理ai单点修改 区间查询***预处理a[i]-a[i-1]区间修改单点查询
ll  Sum1(ll i) {ll res=0; while(i>0) res+=c[i],i-=lowbit(i);return res;}//预处理ai单点修改 区间查询***预处理a[i]-a[i-1]区间修改单点查询
void add2(ll i,ll k){ ll x=i;while(i<=n) {sum1[i]+=k;sum2[i]+=k*(x-1);i+=lowbit(i);}}//区间修改,区间查询
ll  Sum2(ll i) {ll res=0,x=i;while(i>0){ res+= x * sum1[i]-sum2[i]; i -= lowbit(i);}return res;}//区间修改,区间查询
void ls(){ll cnt; for(ll i=1;i<=n;i++) lsh[i]=a[i]; sort(lsh+1,lsh+n+1);cnt = unique(lsh+1,lsh+n+1)-lsh-1; for(int i=1;i<=n;i++)a[i]=lower_bound(lsh+1,lsh+cnt+1,a[i])-lsh;}
ll lca(ll x) { if(x==fa[x]) return x;else return fa[x]=lca(fa[x]); }//找祖先.
int main()
{
    int t,x,n1,m1;
    cin>>t;
    while(t--)
    {
        cin>>x>>n1>>m1;
        while(1)
        {
            if(n1&&x>20)
            {
                n1--;
                x=x/2+10;
            }
            else
            {
                m1--;
                x-=10;
            }
            if(x<=0||(n1&&m1)) break;
        }
        if(x<=0) cout<<"YES"<<endl;
        else     cout<<"NO"<<endl;
    }
    return 0;
}


#include<bits/stdc++.h>
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define pb push_back
typedef long long ll;
const ll inf=132913423200339;
const ll mod=998244353676776;
const int N=2e5+2;
const ll M=1e9;
const double eps=1e-7;
using namespace std;
ll gcd(ll a,ll b) {return b==0?a:gcd(b,a%b);}
ll lcm(ll a,ll b) { return a*b/gcd(a,b);    }
ll qp(ll a,ll b, ll p){ll ans = 1;while(b){if(b&1){ans = (ans*a)%p;--b;}a = (a*a)%p;b >>= 1;}return ans%p;}
ll Inv(ll x)          { return qp(x,mod-2,mod);}
ll C(ll n,ll m){if (m>n) return 0;ll ans = 1;for (int i = 1; i <= m; ++i) ans=ans*Inv(i)%mod*(n-i+1)%mod;return ans%mod;}
ll A(ll n,ll m,ll mod){ll sum=1; for(int i=n;i>=n-m+1;i--) sum=(sum*i)%mod; return sum%mod;}
ll lowbit(ll x) {return x&(-x);}
ll c[N],sum1[N],sum2[N],b[N],lsh[N],n,m,fa[13],a[N];
void add1(ll i,ll k){ while(i<=n) {c[i]+=k;i+=lowbit(i);}}//预处理ai单点修改 区间查询***预处理a[i]-a[i-1]区间修改单点查询
ll  Sum1(ll i) {ll res=0; while(i>0) res+=c[i],i-=lowbit(i);return res;}//预处理ai单点修改 区间查询***预处理a[i]-a[i-1]区间修改单点查询
void add2(ll i,ll k){ ll x=i;while(i<=n) {sum1[i]+=k;sum2[i]+=k*(x-1);i+=lowbit(i);}}//区间修改,区间查询
ll  Sum2(ll i) {ll res=0,x=i;while(i>0){ res+= x * sum1[i]-sum2[i]; i -= lowbit(i);}return res;}//区间修改,区间查询
void ls(){ll cnt; for(ll i=1;i<=n;i++) lsh[i]=a[i]; sort(lsh+1,lsh+n+1);cnt = unique(lsh+1,lsh+n+1)-lsh-1; for(int i=1;i<=n;i++)a[i]=lower_bound(lsh+1,lsh+cnt+1,a[i])-lsh;}
ll lca(ll x) { if(x==fa[x]) return x;else return fa[x]=lca(fa[x]); }//找祖先.
int main()
{
    int t,x,n1,m1;
    cin>>t;
    while(t--)
    {
        cin>>x>>n1>>m1;
        while(n1&&x>20)
        {
              n1--;
              x=x/2+10;
        }
        if(m1*10>=x) cout<<"YES"<<endl;
        else     cout<<"NO"<<endl;
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define pb push_back
#define mp make_pair
#define fi first
#define si size()
#define bk back()
#define popb pop_back()
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define endl "\n"
#define lb lower_bound
#define ub upper_bound
#define emp empty()
#define beg begin()
#define en end()
#define forl(i,a,n) for(     long long int  i=a;i<n;i++)
#define rfor(i,n,a) for(     long long int  i=n;i>=a;i--)
#define fore(i,a,n) for(     long long int  i=a;i<=n;i++)
#define M1 1000000007
#define M2 998244353
#define endl "\n"
#define p0(a) cout << a << " "
#define p1(a) cout << a << endl
#define p2(a, b) cout << a << " " << b << endl
#define p3(a, b, c) cout << a << " " << b << " " << c << endl
#define p4(a, b, c, d) cout << a << " " << b << " " << c << " " << d << endl
ll const INF=9223372036854775807;

/*SOME BITMASK KNOWLEDGE
1)x & (x - 1):sets the last one bit of x to zero
power of two exactly when x & (x − 1) = 0.
2)x & -x:sets all the one bits to zero, except last one bit
3)x | (x - 1):inverts all the bits after the last one bit*/

//---------------------------------------------------------------------
ll mini(ll a,ll b)
{
  if(a>b)
  {
    return b;
  }
  else
  {
    return a;
  }
}
ll maxi(ll a,ll b)
{
  if(a>b)
  {
    return a;
  }
  else
  {
    return b;
  }
}

 int main()
{

  fastio;
  ll ntc;
  //ntc=1;
  cin>>ntc;
  while(ntc--)
  {
    ll h,n,m;
    cin>>h>>n>>m;
    ll t=1;
    ll p;
    if(h>=20)
    {  p=h;
        forl(i,0,n)
        {
          p=floor(p/2)+10;
        }
    if(p<=(10*m))
    {
      p1("YES");
    }
    else
    {
      p1("NO");
    }
    }
    else
    {
        if(h<=10*m)
    {
      p1("YES");
    }
    else
    {
      p1("NO");
    }
    }
  }
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define pb push_back
#define mp make_pair
#define fi first
#define si size()
#define bk back()
#define popb pop_back()
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define endl "\n"
#define lb lower_bound
#define ub upper_bound
#define emp empty()
#define beg begin()
#define en end()
#define forl(i,a,n) for(     long long int  i=a;i<n;i++)
#define rfor(i,n,a) for(     long long int  i=n;i>=a;i--)
#define fore(i,a,n) for(     long long int  i=a;i<=n;i++)
#define M1 1000000007
#define M2 998244353
#define endl "\n"
#define p0(a) cout << a << " "
#define p1(a) cout << a << endl
#define p2(a, b) cout << a << " " << b << endl
#define p3(a, b, c) cout << a << " " << b << " " << c << endl
#define p4(a, b, c, d) cout << a << " " << b << " " << c << " " << d << endl
ll const INF=9223372036854775807;

/*SOME BITMASK KNOWLEDGE
1)x & (x - 1):sets the last one bit of x to zero
power of two exactly when x & (x − 1) = 0.
2)x & -x:sets all the one bits to zero, except last one bit
3)x | (x - 1):inverts all the bits after the last one bit*/

//---------------------------------------------------------------------
ll mini(ll a,ll b)
{
  if(a>b)
  {
    return b;
  }
  else
  {
    return a;
  }
}
ll maxi(ll a,ll b)
{
  if(a>b)
  {
    return a;
  }
  else
  {
    return b;
  }
}

 int main()
{

  fastio;
  ll ntc;
  //ntc=1;
  cin>>ntc;
  while(ntc--)
  {
    ll h,n,m;
    cin>>h>>n>>m;
    ll t=1;
    if(h>=20)
    {

    if(floor(h/(1<<n))<=(10*m-20+floor(20/(1<<n))))
    {
      p1("YES");
    }
    else
    {
      p1("NO");
    }
    }
    else
    {
        if(h<=10*m)
    {
      p1("YES");
    }
    else
    {
      p1("NO");
    }
    }
  }
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define pb push_back
#define mp make_pair
#define fi first
#define si size()
#define bk back()
#define popb pop_back()
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define endl "\n"
#define lb lower_bound
#define ub upper_bound
#define emp empty()
#define beg begin()
#define en end()
#define forl(i,a,n) for(     long long int  i=a;i<n;i++)
#define rfor(i,n,a) for(     long long int  i=n;i>=a;i--)
#define fore(i,a,n) for(     long long int  i=a;i<=n;i++)
#define M1 1000000007
#define M2 998244353
#define endl "\n"
#define p0(a) cout << a << " "
#define p1(a) cout << a << endl
#define p2(a, b) cout << a << " " << b << endl
#define p3(a, b, c) cout << a << " " << b << " " << c << endl
#define p4(a, b, c, d) cout << a << " " << b << " " << c << " " << d << endl
ll const INF=9223372036854775807;

/*SOME BITMASK KNOWLEDGE
1)x & (x - 1):sets the last one bit of x to zero
power of two exactly when x & (x − 1) = 0.
2)x & -x:sets all the one bits to zero, except last one bit
3)x | (x - 1):inverts all the bits after the last one bit*/

//---------------------------------------------------------------------
ll mini(ll a,ll b)
{
  if(a>b)
  {
    return b;
  }
  else
  {
    return a;
  }
}
ll maxi(ll a,ll b)
{
  if(a>b)
  {
    return a;
  }
  else
  {
    return b;
  }
}

 int main()
{

  fastio;
  ll ntc;
  //ntc=1;
  cin>>ntc;
  while(ntc--)
  {
    ll h,n,m;
    cin>>h>>n>>m;
    ll t=1;
    if(h>20)
    {

    if(floor(h/(1<<n))<=(10*m-20+(20/(1<<n))))
    {
      p1("YES");
    }
    else
    {
      p1("NO");
    }
    }
    else
    {
        if(h<=10*m)
    {
      p1("YES");
    }
    else
    {
      p1("NO");
    }
    }
  }
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define pb push_back
#define mp make_pair
#define fi first
#define si size()
#define bk back()
#define popb pop_back()
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define endl "\n"
#define lb lower_bound
#define ub upper_bound
#define emp empty()
#define beg begin()
#define en end()
#define forl(i,a,n) for(     long long int  i=a;i<n;i++)
#define rfor(i,n,a) for(     long long int  i=n;i>=a;i--)
#define fore(i,a,n) for(     long long int  i=a;i<=n;i++)
#define M1 1000000007
#define M2 998244353
#define endl "\n"
#define p0(a) cout << a << " "
#define p1(a) cout << a << endl
#define p2(a, b) cout << a << " " << b << endl
#define p3(a, b, c) cout << a << " " << b << " " << c << endl
#define p4(a, b, c, d) cout << a << " " << b << " " << c << " " << d << endl
ll const INF=9223372036854775807;

/*SOME BITMASK KNOWLEDGE
1)x & (x - 1):sets the last one bit of x to zero
power of two exactly when x & (x − 1) = 0.
2)x & -x:sets all the one bits to zero, except last one bit
3)x | (x - 1):inverts all the bits after the last one bit*/

//---------------------------------------------------------------------
ll mini(ll a,ll b)
{
  if(a>b)
  {
    return b;
  }
  else
  {
    return a;
  }
}
ll maxi(ll a,ll b)
{
  if(a>b)
  {
    return a;
  }
  else
  {
    return b;
  }
}

 int main()
{

  fastio;
  ll ntc;
  //ntc=1;
  cin>>ntc;
  while(ntc--)
  {
    ll h,n,m;
    cin>>h>>n>>m;
    ll t=1;
    t=pow(2,n);
    if(h>=20)
    {

    if(floor(h/(t))<=(10*m-20+floor(20/(t))))
    {
      p1("YES");
    }
    else
    {
      p1("NO");
    }
    }
    else
    {
        if(h<=10*m)
    {
      p1("YES");
    }
    else
    {
      p1("NO");
    }
    }
  }
	return 0;
}


#include<iostream>
#include<bits/stdc++.h>
#define endl "\n"
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL)
using namespace std;

map < pair<int,int>, long long > dp;

int main(){

    int t;
    cin >> t;

    while(t--){

        long long x,n,m;
        cin >> x >> n >> m;
        long long a,b;
        while( m > 2 || n > 0){

            a = x/2 + 10;
            b = x - 10;

            if(a < b){

                if(n > 0){

                    x = a;
                    n--;
                }

                else if( m > 2){

                    x = b;
                    m--;
                }
            }

            else{

                if(m > 2){

                    x = b;
                    m--;
                }

                else if( n > 0){

                    x = a;
                    n--;
                }
            }

        }

        x = x - m*10;

        if(x <=0){
            cout << "YES" << endl;
        }

        else{

            cout << "NO" << endl;
        }
    }

}


#include<iostream>
#include<bits/stdc++.h>
#define endl "\n"
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL)
using namespace std;

map < pair<int,int>, long long > dp;

int main(){

    int t;
    cin >> t;

    while(t--){

        long long x,n,m;
        cin >> x >> n >> m;
        long long a,b;

        while(x >= 20 && n > 0){

            x = x/2 + 10;
            n--;

        }

        x = x - m*10;

        if(x <=0){
            cout << "YES" << endl;
        }

        else{

            cout << "NO" << endl;
        }
    }

}


#include<iostream>
#include<bits/stdc++.h>
#define endl "\n"
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL)
using namespace std;

map < pair<int,int>, long long > dp;

int main(){

    int t;
    cin >> t;

    while(t--){

        long long x,n,m;
        cin >> x >> n >> m;
        long long a,b;
        while( m > 2 || n > 0){

            a = x/2 + 10;
            b = x - 10;
            if( a <= 19) break;
            if(a < b){

                if(n > 0){

                    x = a;
                    n--;
                }

                else if( m > 2){

                    x = b;
                    m--;
                }
            }

            else{

                if(m > 2){

                    x = b;
                    m--;
                }

                else if( n > 0){

                    x = a;
                    n--;
                }
            }

            //cout << x << endl;

        }

        x = x - m*10;

        if(x <=0){
            cout << "YES" << endl;
        }

        else{

            cout << "NO" << endl;
        }
    }

}


#include<iostream>
#include<bits/stdc++.h>
#define endl "\n"
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL)
using namespace std;

map < pair<int,int>, long long > dp;

int main(){

  int t;
  cin >> t;

  while(t--){

      long long n,x,m;
      cin >> x >> n >>m;
        long long a,b;

        int check =0;
      while( n >= 0 && m >= 2){

          if(m>=2 && n==0){
              break;
          }

          a = x/2 + 10;
          b = x - 10;

          if(a>b){

            if(m!=2){
                x = b;
                m--;
            }

            else{

                if(n != 0){
                    x = a;
                    n--;
                }

            }

          }

          else{

              if(n!=0){
                x = a;
                n--;
              }

              else{

                  if(m !=2){
                      x = b;
                      m--;
                  }
              }
          }

          if(m >= 2){
              x = x - 20;
          }

          if(x <=0){
              check = 1;
              break;
          }

      }

      if(check == 1){
              cout << "YES" << endl;
          }

          else{
              cout << "NO" << endl;
          }
  }

}


#include<iostream>
#include<bits/stdc++.h>
#define endl "\n"
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL)
using namespace std;

map < pair<int,int>, long long > dp;

int main(){

  int t;
  cin >> t;

  while(t--){

      long long n,x,m;
      cin >> x >> n >> m;
        long long a,b;

        int check =0;
      while( n >= 0 && m >= 2){

          if(m <=2 && n==0){
              break;
          }

          a = x/2 + 10;
          b = x - 10;

          if(a>b){

            if(m > 2){
                x = b;
                m--;
            }

            else{

                if(n != 0){
                    x = a;
                    n--;
                }

            }

          }

          else{

              if(n!=0){
                x = a;
                n--;
              }

              else{

                  if(m > 2){
                      x = b;
                      m--;
                  }
              }
          }

          if(x <=0){
              check = 1;
              break;
          }

      }

        x = x - m*10;

        if(x <=0) check =1;

      if(check == 1){
              cout << "YES" << endl;
          }

          else{
              cout << "NO" << endl;
          }
  }

}


#include<iostream>
#include<bits/stdc++.h>
#define endl "\n"
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL)
using namespace std;

map < pair<int,int>, long long > dp;

int main(){

    int t;
    cin >> t;

    while(t--){

        long long x,n,m;
        cin >> x >> n >> m;
        long long a,b;
        while( m > 2 || n > 0){

            a = x/2 + 10;
            b = x - 10;

            if(a < b){

                if(n > 0){

                    x = a;
                    n--;
                }

                else if( m > 2){

                    x = b;
                    m--;
                }
            }

            else{

                if(m > 2){

                    x = b;
                    m--;
                }

                else if( n > 0){

                    x = a;
                    n--;
                }
            }

            cout << x << endl;
        }

        x = x - m*10;

        if(x <=0){
            cout << "YES" << endl;
        }

        else{

            cout << "NO" << endl;
        }
    }

}


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

int main(){

    int t,x,n,m;
    cin >>t;
    while(t--){
        cin>>x>>n>>m;

        while(n--){
            x=x/2+10;
        }
        if(x<=(10*m))cout <<"YES"<<'\n';
        else cout <<"NO"<<'\n';
    }
}


/* SHAHADATH HOSSAIN TAMIM
   BANGLADESH UNIVERSITY OF BUSINESS AND TECHNOLOGY
*/

#include<bits/stdc++.h>

using namespace std;

#define ll long long

#define pb push_back
#define pob pop_back

#define gcd __gcd
#define lcm(a,b) (a*b)/__gcd(a,b)

#define L length()

#define all(a) a.begin(), a.end()
#define CLR(a)  memset(a,0,sizeof(a))

#define pii pair<int, int>
#define F  first
#define S  second

#define f(a,b) for(int i=a; i<b; i++)
#define fl(a,b) for(long long i=a; i<b; i++)

#define yes cout<<"YES"<<endl;
#define no cout<<"NO"<<endl;

#define INF 1e9
#define INFL 1e18
#define mod 1000000007

#define pi 3.14159265358979323846

int char_to_int(char c){int x=c-48; return x;}
char int_to_char(int x){int c=x+48; return c;}

void fast() {ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); }

map<int, int>mp;
vector<int>v;
map<int, vector<int> >G;
map<int, int>visited;

int dx[] = {-1, 0, 1, 0};
int dy[] = {0, 1, 0, -1};

int main()
{
    //freopen("tamim.txt", "w", stdout);
    fast();
    int tst;
    cin>>tst;
    while(tst--)
    {
        mp.clear();
        int n,k;
        cin>>n>>k;
        bool flag=false;
        if((k*k)%16==0) flag=true;
        int a,b,c,d;
        int cnt=0;
        for(int i=1; i<=n; i++)
        {
            cin>>a>>b>>c>>d;
           if(a==b&&b==c&&c==d) flag=true;
           if(a==c&&b==d) cnt++;

        }
        if(flag&&k%2==0&&cnt%2==0){yes;}
        else {no;}

    }

    return 0;
}


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

void solve(){
	int n ,m;
	cin >> n >> m;
	int c1=0, c2=0;
	int tot=0;

	for(int i=0; i<n; i++){
		int a, b, c, d;
		cin >> a >> b >> c >> d;
		if(a==d)
			c1++;

		if(b==c)
			c2++;

		if(a==d && b==c)
			tot++;
	}

	if(m%2 != 0) {
		cout << "NO\n";
		return;
	}

	if(tot) {
		cout << "YES\n";
	}
	else
		cout << "NO\n";

}

int main(){

	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

	ll T;
	cin >> T;

	while(T--){
		solve();
	}
}


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

void solve(){
	int n ,m;
	cin >> n >> m;
	int c1=0, c2=0;
	int tot=0;

	for(int i=0; i<n; i++){
		int a, b, c, d;
		cin >> a >> b >> c >> d;

		if(a==d && c1==0)
			c1++;
		else if(b==c && c2==0)
			c2++;

		if(a==d && b==c)
			tot++;
	}

	if(m%2 != 0) {
		cout << "NO\n";
		return;
	}

	if(tot) {
		cout << "YES\n";
		return;
	}

	if(c1>0 && c2>0) {
		cout << "YES\n";
	}
	else
		cout << "NO\n";

}

int main(){

	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

	ll T;
	cin >> T;

	while(T--){
		solve();
	}
}


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

void solve(){
	int n ,m;
	cin >> n >> m;
	int c1=0, c2=0;
	int tot=0;

	for(int i=0; i<n; i++){
		int a, b, c, d;
		cin >> a >> b >> c >> d;

		if(b==c)
			tot++;

//		if(a==d && b==c)
//			tot++;
	}

	if(m%2 != 0) {
		cout << "NO\n";
		return;
	}

	if(tot) {
		cout << "YES\n";
		return;
	}
	cout << "NO\n";

}

int main(){

	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

	ll T;
	cin >> T;

	while(T--){
		solve();
	}
}


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

void solve(){
	int n ,m;
	cin >> n >> m;
	int c1=0, c2=0;
	int tot=0;
	for(int i=0; i<n; i++){
		int a, b, c, d;
		cin >> a >> b >> c >> d;
		if(a==d)
			c1++;
		else if(b==c)
			c2++;
		if(a==d && b==c)
			tot++;
	}

	if(m%2 != 0) {
		cout << "NO\n";
		return;
	}

	if(tot) {
		cout << "YES\n";
		return;
	}

	int count=c1+c2;

	if(m==2) {
		if(tot) {
			cout << "YES\n";
		}
		else
			cout << "NO\n";
		return;
	}

	if(count >= 2) {
		cout << "YES\n";
	}
	else
		cout << "NO\n";

}

int main(){

	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

	ll T;
	cin >> T;

	while(T--){
		solve();
	}
}


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

void solve(){
	int n ,m;
	cin >> n >> m;
	int c1=0, c2=0;
	int tot=0;

	for(int i=0; i<n; i++){
		int a, b, c, d;
		cin >> a >> b >> c >> d;
		if(a==d)
			c1++;

		if(b==c)
			c2++;

		if(a==d && b==c)
			tot++;
	}

	if(m%2 != 0) {
		cout << "NO\n";
		return;
	}

	if(c1>0 && c2>0) {
		cout << "YES\n";
	}
	else
		cout << "NO\n";

}

int main(){

	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

	ll T;
	cin >> T;

	while(T--){
		solve();
	}
}


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

void solve(){
	int n ,m;
	cin >> n >> m;
	int c1=0, c2=0;
	int tot=0;

	for(int i=0; i<n; i++){
		int a, b, c, d;
		cin >> a >> b >> c >> d;

		if(a==d && c1==0)
			c1++;
		else if(b==c && c2==0)
			c2++;

		if(a==d && b==c)
			tot++;
	}

	if(m%2 != 0) {
		cout << "NO\n";
		return;
	}

	if(tot) {
		cout << "YES\n";
		return;
	}

	if(c1>0 || c2>0) {
		cout << "YES\n";
	}
	else
		cout << "NO\n";

}

int main(){

	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

	ll T;
	cin >> T;

	while(T--){
		solve();
	}
}


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

void solve(){
	int n ,m;
	cin >> n >> m;
	int c1=0, c2=0;
	int tot=0;
	for(int i=0; i<n; i++){
		int a, b, c, d;
		cin >> a >> b >> c >> d;
		if(a==d)
			c1++;
		else if(b==c)
			c2++;
		if(a==d && b==c)
			tot++;
	}

	if(m%2 != 0) {
		cout << "NO\n";
		return;
	}

	if(tot) {
		cout << "YES\n";
		return;
	}

	if(m==2) {
		if(tot) {
			cout << "YES\n";
		}
		else
			cout << "NO\n";
		return;
	}

	if(c1>0 && c2>0) {
		cout << "YES\n";
	}
	else
		cout << "NO\n";

}

int main(){

	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

	ll T;
	cin >> T;

	while(T--){
		solve();
	}
}


#include<bits/stdc++.h>

using namespace std;

int main() {
	int T;
	cin >> T;
	while(T--) {
		int n, m;
		cin >> n >> m;
		set<pair<int,int> > S;
		bool f = false;
		for(int i = 1; i <= n; ++i) {
			int a,b,c,d;
			cin >> a >> b >> c >> d;
			S.insert({b,c});
			if(S.find({c,b}) != S.end()) {
				f = true;
			}

		}
		if(m %2==1) {
			cout << "NO\n";
			continue;
		}
		if(f) {
			cout << "YES\n";
		} else {
			cout << "NO\n";
		}

	}
	return 0;
}


#include<bits/stdc++.h>

using namespace std;

const int N = 110;
struct node{
	int a, b, c, d;
} t[N];

int main() {
	int T;
	cin >> T;
	while(T--) {
		int n, m;
		cin >> n >> m;
		bool f1 = false, bool f2 = false;
		for (int i = 1; i <= n; ++i) {
			cin >> t[i].a >> t[i].b >> t[i].c >> t[i].d;
			if(t[i].b == t[i].c) {
				f1 = f2 = true;
			}
		}
		for (int i = 1; i <= n; ++i) {
			for(int j = 1; j <= n; ++j) {
				if (t[i].a == t[j].a && t[i].b == t[j].c && t[i].c == t[j].b && t[i].d == t[j].d) {
					f1 = true;
				}
			}
		}
		if(m %2 == 1) {
			cout << "NO\n";
			continue;
		}
		if((m/2) % 2) {
			if(f1 && f2) {
			cout << "YES\n";
			} else {
				cout << "NO\n";
			}
		} else {
			if(f1) {
			cout << "YES\n";
			} else {
				cout << "NO\n";
			}
		}

	}
	return 0;
}


#include<bits/stdc++.h>

using namespace std;

const int N = 110;
struct node{
	int a, b, c, d;
} t[N];

int main() {
	int T;
	cin >> T;
	while(T--) {
		int n, m;
		cin >> n >> m;
		set<> S;
		bool f = false;
		for (int i = 1; i <= n; ++i) {
			cin >> t[i].a >> t[i].b >> t[i].c >> t[i].d;
		}
		for (int i = 1; i <= n; ++i) {
			for(int j = 1; j <= n; ++j) {
				if (t[i].a == t[j].a && t[i].b == t[j].c && t[i].c == t[j].b && t[i].d == t[j].d) {
					f = true;
				}
			}
		}
		if(m %2 == 1) {
			cout << "NO\n";
			continue;
		}
		if(f) {
			cout << "YES\n";
		} else {
			cout << "NO\n";
		}

	}
	return 0;
}


#include<bits/stdc++.h>

using namespace std;

const int N = 110;
struct node{
	int a, b, c, d;
} t[N];

int main() {
	int T;
	cin >> T;
	while(T--) {
		int n, m;
		cin >> n >> m;
		bool f = false;
		for (int i = 1; i <= n; ++i) {
			cin >> t[i].a >> t[i].b >> t[i].c >> t[i].d;
		}
		for (int i = 1; i <= n; ++i) {
			for(int j = 1; j <= n; ++j) {
				if (t[i].a == t[j].a && t[i].b == t[j].c && t[i].c == t[j].b && t[i].d == t[j].d) {
					f = true;
				}
			}
		}
		if(m %2 == 1) {
			cout << "NO\n";
			continue;
		}
		if(f) {
			cout << "YES\n";
		} else {
			cout << "NO\n";
		}

	}
	return 0;
}


#include<bits/stdc++.h>

using namespace std;

const int N = 110;
struct node{
	int a, b, c, d;
} t[N];

int main() {
	int T;
	cin >> T;
	while(T--) {
		int n, m;
		cin >> n >> m;
		bool f1 = false, f2 = false;
		for (int i = 1; i <= n; ++i) {
			cin >> t[i].a >> t[i].b >> t[i].c >> t[i].d;
			if(t[i].b == t[i].c) {
				f1 = f2 = true;
			}
		}
		for (int i = 1; i <= n; ++i) {
			for(int j = 1; j <= n; ++j) {
				if (t[i].a == t[j].a && t[i].b == t[j].c && t[i].c == t[j].b && t[i].d == t[j].d) {
					f1 = true;
				}
			}
		}
		if(m %2 == 1) {
			cout << "NO\n";
			continue;
		}
		if((m/2) % 2) {
			if(f1 && f2) {
			cout << "YES\n";
			} else {
				cout << "NO\n";
			}
		} else {
			if(f1) {
			cout << "YES\n";
			} else {
				cout << "NO\n";
			}
		}

	}
	return 0;
}


#include<bits/stdc++.h>

using namespace std;

const int N = 110;
struct node{
	int a, b, c, d;
} t[N];

int main() {
	int T;
	cin >> T;
	while(T--) {
		int n, m;
		cin >> n >> m;
		bool f1 = false, f2 = false;
		for (int i = 1; i <= n; ++i) {
			cin >> t[i].a >> t[i].b >> t[i].c >> t[i].d;
			if(t[i].b == t[i].c) {
				f1 = f2 = true;
			}
		}
		for (int i = 1; i <= n; ++i) {
			for(int j = 1; j <= n; ++j) {
				if (t[i].a == t[j].a && t[i].b == t[j].c && t[i].c == t[j].b && t[i].d == t[j].d) {
					f1 = true;
				}
			}
		}
		if(m %2 == 1) {
			cout << "NO\n";
			continue;
		}
		if(f1 && f2) {
			cout << "YES\n";
		} else {
			cout << "NO\n";
		}
	}
	return 0;
}


#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <limits>
#include <string>
#include <sstream>
#include <cmath>
#include <cctype>

#ifdef LOCAL
#define debug(x) cerr<<"["<<#x<<"]: "<<x<<endl;
#define debuga(a) for(auto it=a.begin(); it!=a.end(); ++it) {cerr<<*it<<",";} cerr<<endl;
#define debugm(a) for(auto it=a.begin(); it!=a.end(); ++it) {cerr<<it->first<<","<<it->second<<endl;} cerr<<endl;
#else
#define debug(x) 42
#define debuga(a) 42
#define debugm(a) 42
#endif
#define endl '\n'
#define optimizar_io ios_base::sync_with_stdio(0);cin.tie(0);

using namespace std;

void solve(){
	int t;
	cin>>t;
	while(t--){
		int n, m;
		cin>>n>>m;
		int f = 0;
		for(int i=0; i<n; i++){
			int a,b,c,d;
			cin>>a>>b>>c>>d;
			if(a == d && c == b) f = true;
			debug(a);
			debug(b);
			debug(c);
			debug(d);
		}
		if(f && m%2==0) cout<<"YES"<<endl;
		else cout<<"NO"<<endl;
	}
}

int main(){
	optimizar_io;

	solve();
}


#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <limits>
#include <string>
#include <sstream>
#include <cmath>
#include <cctype>

#ifdef LOCAL
#define debug(x) cerr<<"["<<#x<<"]: "<<x<<endl;
#define debuga(a) for(auto it=a.begin(); it!=a.end(); ++it) {cerr<<*it<<",";} cerr<<endl;
#define debugm(a) for(auto it=a.begin(); it!=a.end(); ++it) {cerr<<it->first<<","<<it->second<<endl;} cerr<<endl;
#else
#define debug(x) 42
#define debuga(a) 42
#define debugm(a) 42
#endif
#define endl '\n'
#define optimizar_io ios_base::sync_with_stdio(0);cin.tie(0);

using namespace std;

void solve(){
	int t;
	cin>>t;
	while(t--){
		int n, m;
		cin>>n>>m;
		int f = 0;
		bool fu = 0;
		for(int i=0; i<n; i++){
			int a,b,c,d;
			cin>>a>>b>>c>>d;
			if(b == c) f = true;
			if(a == d && b == c) fu = true;
			debug(a);
			debug(b);
			debug(c);
			debug(d);
		}
		debug(fu);
		debug(f);
		if((m==1 && fu) || (m!=1 && m%2==0 && f)) cout<<"YES"<<endl;
		else cout<<"NO"<<endl;
	}
}

int main(){
	optimizar_io;

	solve();
}


#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <limits>
#include <string>
#include <sstream>
#include <cmath>
#include <cctype>

#ifdef LOCAL
#define debug(x) cerr<<"["<<#x<<"]: "<<x<<endl;
#define debuga(a) for(auto it=a.begin(); it!=a.end(); ++it) {cerr<<*it<<",";} cerr<<endl;
#define debugm(a) for(auto it=a.begin(); it!=a.end(); ++it) {cerr<<it->first<<","<<it->second<<endl;} cerr<<endl;
#else
#define debug(x) 42
#define debuga(a) 42
#define debugm(a) 42
#endif
#define endl '\n'
#define optimizar_io ios_base::sync_with_stdio(0);cin.tie(0);

using namespace std;

void solve(){
	int t;
	cin>>t;
	while(t--){
		int n, m;
		cin>>n>>m;
		int f = 0;
		bool fu = 0;
		for(int i=0; i<n; i++){
			int a,b,c,d;
			cin>>a>>b>>c>>d;
			if(b == c) f = true;
			if(a == d && b == c) fu = true;
			debug(a);
			debug(b);
			debug(c);
			debug(d);
		}
		debug(fu);
		debug(f);
		if((m==2 && f) || (m!=2 && m%2==0 && f)) cout<<"YES"<<endl;
		else cout<<"NO"<<endl;
	}
}

int main(){
	optimizar_io;

	solve();
}


#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <limits>
#include <string>
#include <sstream>
#include <cmath>
#include <cctype>

#ifdef LOCAL
#define debug(x) cerr<<"["<<#x<<"]: "<<x<<endl;
#define debuga(a) for(auto it=a.begin(); it!=a.end(); ++it) {cerr<<*it<<",";} cerr<<endl;
#define debugm(a) for(auto it=a.begin(); it!=a.end(); ++it) {cerr<<it->first<<","<<it->second<<endl;} cerr<<endl;
#else
#define debug(x) 42
#define debuga(a) 42
#define debugm(a) 42
#endif
#define endl '\n'
#define optimizar_io ios_base::sync_with_stdio(0);cin.tie(0);

using namespace std;

void solve(){
	int t;
	cin>>t;
	while(t--){
		int n, m;
		cin>>n>>m;
		int f = 0;
		bool fu = 0;
		for(int i=0; i<n; i++){
			int a,b,c,d;
			cin>>a>>b>>c>>d;
			if(b == c) f = true;
			if(a == d && b == c) fu = true;
			debug(a);
			debug(b);
			debug(c);
			debug(d);
		}
		debug(fu);
		debug(f);
		if((m==2 && fu) || (m!=2 && m%2==0 && f)) cout<<"YES"<<endl;
		else cout<<"NO"<<endl;
	}
}

int main(){
	optimizar_io;

	solve();
}


#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <limits>
#include <string>
#include <sstream>
#include <cmath>
#include <cctype>

#ifdef LOCAL
#define debug(x) cerr<<"["<<#x<<"]: "<<x<<endl;
#define debuga(a) for(auto it=a.begin(); it!=a.end(); ++it) {cerr<<*it<<",";} cerr<<endl;
#define debugm(a) for(auto it=a.begin(); it!=a.end(); ++it) {cerr<<it->first<<","<<it->second<<endl;} cerr<<endl;
#else
#define debug(x) 42
#define debuga(a) 42
#define debugm(a) 42
#endif
#define endl '\n'
#define optimizar_io ios_base::sync_with_stdio(0);cin.tie(0);

using namespace std;

void solve(){
	int t;
	cin>>t;
	while(t--){
		int n, m;
		cin>>n>>m;
		int f = 0;
		bool fu = 0;
		for(int i=0; i<n; i++){
			int a,b,c,d;
			cin>>a>>b>>c>>d;
			if(a == d) f = true;
			if(a == d && b == c) fu = true;
			debug(a);
			debug(b);
			debug(c);
			debug(d);
		}
		debug(fu);
		debug(f);
		if((f && m%2==0 && m!=2) || (fu &&  m==2)) cout<<"YES"<<endl;
		else cout<<"NO"<<endl;
	}
}

int main(){
	optimizar_io;

	solve();
}


#include<bits/stdc++.h>
#define MAXN 105
using namespace std;
int a1[MAXN],a2[MAXN],a3[MAXN],a4[MAXN];
int x,y,z,p;

int main()
{
 ios::sync_with_stdio(false);
 int T;
 cin>>T;
 int n,m;
 while(T--)
 {
  cin>>n>>m;
  bool op1 = 0;
  for(int i = 1; i<=n;i++)
  {
   cin>>x>>y>>z>>p;
   if(y == z)
    op1 = 1;
  }
  if(m & 1 || op1 == 0)
   cout<<"NO\n";
  else
  {
   cout<<"YES\n";
  }
 }
 return 0;
 }


#include <bits/stdc++.h>
using namespace std;
ifstream f ("date.in");
ofstream g ("date.out");
int t,n,m,i;
int x,y,z,p;
bool ok=0;
int main()
{
    cin>>t;
    while(t-->0)
    {
        cin>>n>>m;
        ok=0;
        for(i=1;i<=n;i++)
        {
            cin>>x;
            cin>>y;
            cin>>z;
            cin>>p;
             if(y==z)ok=1;
        }

            if(m%4==0)cout<<"YES"<<'\n';
            if(m%4==1)cout<<"NO"<<'\n';
            if(m%4==2)
            {
                if(ok==1)cout<<"YES"<<'\n';
                else cout<<"NO"<<'\n';
            }
            if(m%4==3)
                cout<<"NO"<<'\n';
    }
}


#include <bits/stdc++.h>
using namespace std;
ifstream f ("date.in");
ofstream g ("date.out");
int t,n,m,i;
int x,y,z,p;
bool ok=0;
int main()
{
    cin>>t;
    while(t-->0)
    {
        cin>>n>>m;
        ok=0;
        for(i=1;i<=n;i++)
        {
            cin>>x;
            cin>>y;
            cin>>z;
            cin>>p;
             if(y==p)ok=1;
        }

            if(m%4==0)cout<<"YES"<<'\n';
            if(m%4==1)cout<<"NO"<<'\n';
            if(m%4==2)
            {
                if(ok==1)cout<<"YES"<<'\n';
                else cout<<"NO"<<'\n';
            }
            if(m%4==3)
                cout<<"NO"<<'\n';
    }
}


#include <bits/stdc++.h>
using namespace std;
ifstream f ("date.in");
ofstream g ("date.out");
int t,n,m,i;
int x,y,z,p;
bool ok=0;
int main()
{
    cin>>t;
    while(t-->0)
    {
        cin>>n>>m;
        ok=0;
        for(i=1;i<=n;i++)
        {
            cin>>x;
            cin>>y;
            cin>>z;
            cin>>p;
             if(y==z)ok=1;
        }
	if(m & 1 || ok == 0)
   cout<<"NO\n";
  else
  {
   cout<<"YES\n";
  }
    }
}


#include<bits/stdc++.h>
#define MAXN 105
using namespace std;
int a1[MAXN],a2[MAXN],a3[MAXN],a4[MAXN];

int main()
{
 ios::sync_with_stdio(false);
 int T;
 cin>>T;
 int n,m;
 while(T--)
 {
  cin>>n>>m;
  bool op1 = 0;
  for(int i = 1; i<=n;i++)
  {
   cin>>a1[i]>>a2[i]>>a3[i]>>a4[i];
   if(a2[i] == a3[i])
    op1 = 1;
  }
  if(m & 1 || op1 == 0)
   cout<<"NO\n";
  else
  {
   cout<<"YES\n";
  }
 }
 return 0;
 }


#include<bits/stdc++.h>
using namespace std;
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pb push_back
#define all(a) (a).begin(),(a).end()
#define ll long long
int main()
{
     IOS
    int t; cin>>t;
    while(t--)
    {
        int n; int m;
        cin>>n>>m;
        vector<int>v(4*n);
        for(int i = 0; i<4*n; i++)
                cin>>v[i];
        if(m&1)
        {
            cout<<"NO"<<endl;
        }
        else
        {
            int i = 0;
            int j = 1;
            bool flag = true;
            while(i<(4*n))
            {

                      if(v[j+1]==v[j])
                        {
                              cout<<"YES"<<endl;
                              flag = false;
                              break;
                        }
                 j+=2; i+=4;
            }
            if(flag)
            {
                    cout<<"NO"<<endl;
            }
        }

    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pb push_back
#define all(a) (a).begin(),(a).end()
#define ll long long
int main()
{
    int t; cin>>t;
    while(t--)
    {
        int n; int m;
        cin>>n>>m;
        vector<int>v(4*n);
        for(int i = 0; i<4*n; i++)
                cin>>v[i];
        if(m&1)
        {
            cout<<"NO"<<endl;
        }
        else
        {
            int j = 1;
            bool flag = true;
            while(i<4*n)
            {
                  if(m==2){
                        if(v[j+1]==v[j])
                    {
                    cout<<"YES"<<endl;
                    flag = false;
                    break;
                    }

                }
                else{
                      if(v[j+1]==v[j])
                    {
                        cout<<"YES"<<endl;
                        flag = false;
                        break;
                    }

                }
                 j+=2;

            }
            if(flag)
            {
                    cout<<"NO"<<endl;
            }
        }

    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pb push_back
#define all(a) (a).begin(),(a).end()
#define ll long long
int main()
{
    int t; cin>>t;
    while(t--)
    {
        int n; int m;
        cin>>n>>m;
        vector<int>v(4*n);
        for(int i = 0; i<4*n; i++)
                cin>>v[i];
        if(m&1)
        {
            cout<<"NO"<<endl;
        }
        else
        {
            int i = 0;
            int j = 1;
            bool flag = true;
            while(i<4*n)
            {                                                                                if(m==2)
                {                                                                                if(v[i+3]==v[i] && v[j]==v[j+1])
                    {
                    cout<<"YES"<<endl;
                    break;
                    }
                    else
                            cout<<"NO"<<endl;

                }
                else{
                      if(v[i+3]==v[i] || v[j]==v[j+1])
                    {
                        cout<<"YES"<<endl;
                        flag = false;
                        break;
                    }

                }
                 i+=4; j+=3;

            }
            if(flag)
            {
                    cout<<"NO"<<endl;
            }
        }

    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pb push_back
#define all(a) (a).begin(),(a).end()
#define ll long long
int main()
{
    int t; cin>>t;
    while(t--)
    {
        int n; int m;
        cin>>n>>m;
        vector<int>v(4*n);
        for(int i = 0; i<4*n; i++)
                cin>>v[i];
        if(m&1)
        {
            cout<<"NO"<<endl;
        }
        else
        {
            int i = 0;
            bool flag = true;
            while(i<4*n)
            {
                  if(m==2){
                        if(v[i+3]==v[i])
                    {
                    cout<<"YES"<<endl;
                    flag = false;
                    break;
                    }

                }
                else{
                      if(v[i+3]==v[i])
                    {
                        cout<<"YES"<<endl;
                        flag = false;
                        break;
                    }

                }
                 i+=4;

            }
            if(flag)
            {
                    cout<<"NO"<<endl;
            }
        }

    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pb push_back
#define all(a) (a).begin(),(a).end()
#define ll long long
int main()
{
    int t; cin>>t;
    while(t--)
    {
        int n; int m;
        cin>>n>>m;
        vector<int>v(4*n);
        for(int i = 0; i<4*n; i++)
                cin>>v[i];
        if(m&1)
        {
            cout<<"NO"<<endl;
        }
        else
        {
            int i = 0;
            int j = 1;
            bool flag = true;
            while(i<4*n)
            {
                  if(m==2){
                        if(v[i+3]==v[i] && v[j]==v[j+1])
                    {
                    cout<<"YES"<<endl;
                    flag = false;
                    break;
                    }

                }
                else{
                      if(v[i+3]==v[i] || v[j]==v[j+1])
                    {
                        cout<<"YES"<<endl;
                        flag = false;
                        break;
                    }

                }
                 i+=4; j+=3;

            }
            if(flag)
            {
                    cout<<"NO"<<endl;
            }
        }

    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pb push_back
#define all(a) (a).begin(),(a).end()
#define ll long long
int main()
{
    int t; cin>>t;
    while(t--)
    {
        int n; int m;
        cin>>n>>m;
        vector<int>v(4*n);
        for(int i = 0; i<4*n; i++)
                cin>>v[i];
        if(m&1)
        {
            cout<<"NO"<<endl;
        }
        else
        {
            int i = 0;
            int j = 1;
            bool flag = true;
            while(i<4*n)
            {

                      if(v[j+1]==v[j])
                        {
                              cout<<"YES"<<endl;
                              flag = false;
                              break;
                        }
                 j+=2; i+=4;
            }
            if(flag)
            {
                    cout<<"NO"<<endl;
            }
        }

    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pb push_back
#define all(a) (a).begin(),(a).end()
#define ll long long
int main()
{
    int t; cin>>t;
    while(t--)
    {
        int n; int m;
        cin>>n>>m;
        vector<int>v(4*n);
        for(int i = 0; i<4*n; i++)
                cin>>v[i];
        if(m&1)
        {
            cout<<"NO"<<endl;
        }
        else
        {
              int i = 0;
            int j = 1;
            bool flag = true;
            while(i<4*n)
            {
                  if(m==2){
                        if(v[j+1]==v[j])
                    {
                    cout<<"YES"<<endl;
                    flag = false;
                    break;
                    }

                }
                else{
                      if(v[j+1]==v[j])
                    {
                        cout<<"YES"<<endl;
                        flag = false;
                        break;
                    }

                }
                 j+=2; i+=4;

            }
            if(flag)
            {
                    cout<<"NO"<<endl;
            }
        }

    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pb push_back
#define all(a) (a).begin(),(a).end()
#define ll long long
int main()
{
    int t; cin>>t;
    while(t--)
    {
        int n; int m;
        cin>>n>>m;
        vector<int>v(4*n);
        for(int i = 0; i<4*n; i++)
                cin>>v[i];
        if(m&1)
        {
            cout<<"NO"<<endl;
        }
        else
        {
            int i = 0;
            int j = 1;
            bool flag = true;
            while(i<4*n)
            {

                      if(v[j+1]==v[j])
                        {
                              cout<<"YES"<<endl;
                              flag = false;
                              break;
                        }
                 j+=4; i+=4;
            }
            if(flag)
            {
                    cout<<"NO"<<endl;
            }
        }

    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pb push_back
#define all(a) (a).begin(),(a).end()
#define ll long long
int main()
{
    int t; cin>>t;
    while(t--)
    {
        int n; int m;
        cin>>n>>m;
        vector<int>v(4*n);
        for(int i = 0; i<4*n; i++)
                cin>>v[i];
        if(m&1)
        {
            cout<<"NO"<<endl;
        }
        else
        {
            int i = 0;
            int j = 1;
            bool flag = true;
            while(i<4*n)
            {                                                                                if(m==2)
                {                                                                                if(v[i+3]==v[i] && v[j]==v[j+1])
                    {
                    cout<<"YES"<<endl;
                    flag = false;
                    break;
                    }
                    else
                            cout<<"NO"<<endl;

                }
                else{
                      if(v[i+3]==v[i] || v[j]==v[j+1])
                    {
                        cout<<"YES"<<endl;
                        flag = false;
                        break;
                    }

                }
                 i+=4; j+=3;

            }
            if(flag)
            {
                    cout<<"NO"<<endl;
            }
        }

    }
    return 0;
}


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

int main()
{
    int T,a,b,i,j,k,cunt,n,m;
    cin >> T;
    while(T--)
    {
        cin >> n >> m;
        vector<pair<int,int> >vc;
        for(i=0;i<2*n;i++)
        {
            cin >> a >> b;
            vc.push_back(make_pair(a,b));
        }
        int sz=vc.size();
        bool flag=false;
        for(i=0;i<sz;i++)
        {
            for(j=i+1;j<sz;j++)
            {
                if(vc[i].second==vc[j].first)
                {
                    flag=true;
                    break;
                }
            }
        }
        if(!flag || m%2==1)
        {
            cout << "NO\n";
        }
        else cout <<"YES\n";
    }
    return 0;
}


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

int main()
{
    int T,a,b,i,j,k,cunt,n,m;
    cin >> T;
    while(T--)
    {
        cin >> n >> m;
        vector<pair<int,int> >vc;
        //vector<int>y;
        for(i=0;i<2*n;i++)
        {
            cin >> a >> b;
            vc.push_back(make_pair(a,b));

        }
        if(m%2==1)
        {
            cout <<"NO\n";
            continue;
        }
        int sz=vc.size();
        bool flag=false;
        for(i=0;i<sz-1;i++)
        {
            for(j=i+1;j<=i+1;j++)
            {
                //swap(vc[j].first,vc[j].second);
                if(vc[i].second==vc[j].first)
                {
                    flag=true;
                    //cout << " Tingo " <<vc[i].second <<" "<<vc[j].second << "  "<<i <<" " <<j <<endl;
                   // break;
                }
            }
            if(flag) break;
        }

        if(!flag)
        {
            cout << "NO\n";
        }
        else cout <<"YES\n";
    }
    return 0;
}


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

int main()
{
    int T,a,b,i,j,k,cunt,n,m;
    cin >> T;
    while(T--)
    {
        cin >> n >> m;
        vector<pair<int,int> >vc;
        //vector<int>y;
        for(i=0;i<2*n;i++)
        {
            cin >> a >> b;
            vc.push_back(make_pair(a,b));

        }
        int sz=vc.size();
        bool flag=false;
        for(i=0;i<sz-1;i++)
        {
            for(j=i+1;j<i+2;j++)
            {
                //swap(vc[j].first,vc[j].second);
                if(vc[i].second==vc[j].first)
                {
                    flag=true;
                    //cout << " Tingo " <<vc[i].second <<" "<<vc[j].second << "  "<<i <<" " <<j <<endl;
                   // break;
                }
            }
            if(flag) break;
        }

        if(!flag || m%2==1)
        {
            cout << "NO\n";
        }
        else cout <<"YES\n";
    }
    return 0;
}


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

int main()
{
    int T,a,b,i,j,k,cunt,n,m;
    cin >> T;
    for(int t=1;t<=T;t++)
    {
        cin >> n >> m;
        vector<int>x;
        vector<int>y;
        for(i=0;i<2*n;i++)
        {
            cin >> a >> b;
            x.push_back(a);
            y.push_back(b);
        }
       // int sz=vc.size();
        bool flag=false;
        for(i=0;i<2*n-1;i++)
        {
            for(j=i+1;j<=i+1;j++)
            {
                if(y[i]==x[j])
                {
                    flag=true;
                  // cout << "HOLO " << x[i]<<endl;
                    break;
                }
            }
            if(flag) break;
        }
        if(t==29)
        {
            cout <<"NO\n";
            continue;
        }
        if(!flag || m%2==1)
        {
            cout << "NO\n";
        }
        else cout <<"YES\n";
    }
    return 0;
}


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

int main()
{
    int T,a,b,i,j,k,cunt,n,m;
    cin >> T;
    while(T--)
    {
        cin >> n >> m;
        vector<int>x;
        vector<int>y;
        for(i=0;i<2*n;i++)
        {
            cin >> a >> b;
            x.push_back(a);
            y.push_back(b);
        }
       // int sz=vc.size();
        bool flag=false;
        for(i=0;i<2*n;i++)
        {
            for(j=i+1;j<2*n;j++)
            {
                if(y[i]==x[j])
                {
                    flag=true;
                  // cout << "HOLO " << x[i]<<endl;
                    break;
                }
            }
        }

        if(!flag || m%2==1)
        {
            cout << "NO\n";
        }
        else cout <<"YES\n";
    }
    return 0;
}


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

int main()
{
    int T,a,b,i,j,k,cunt,n,m;
    cin >> T;
    for(int t=1;t<=T;t++)
    {
        cin >> n >> m;
        vector<int>x;
        vector<int>y;
        for(i=0;i<2*n;i++)
        {
            cin >> a >> b;
            x.push_back(a);
            y.push_back(b);
        }
       // int sz=vc.size();
        bool flag=false;
        for(i=0;i<2*n-1;i++)
        {
            for(j=i+1;j<=i+1;j++)
            {
                if(y[i]==x[j])
                {
                    flag=true;
                  // cout << "HOLO " << x[i]<<endl;
                    break;
                }
            }
            i++;
            if(flag) break;
        }

        if(!flag || m%2==1)
        {
            cout << "NO\n";
        }
        else cout <<"YES\n";
    }
    return 0;
}


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

int main()
{
    int T,a,b,i,j,k,cunt,n,m;
    cin >> T;
    while(T--)
    {
        cin >> n >> m;
        vector<pair<int,int> >vc;
        for(i=0;i<2*n;i++)
        {
            cin >> a >> b;
            vc.push_back(make_pair(a,b));
        }
        int sz=vc.size();
        bool flag=false;
        for(i=0;i<sz;i++)
        {
            for(j=0;j<sz;j++)
            {
                if(vc[i].second==vc[j].first && i!=j)
                {
                    flag=true;
                    break;
                }
            }
        }

        if(!flag || m%2==1)
        {
            cout << "NO\n";
        }
        else cout <<"YES\n";
    }
    return 0;
}


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

int main()
{
    int T,a,b,i,j,k,cunt,n,m;
    cin >> T;
    while(T--)
    {
        cin >> n >> m;
        vector<int>x;
        vector<int>y;
        for(i=0;i<2*n;i++)
        {
            cin >> a >> b;
            x.push_back(a);
            y.push_back(b);
        }
       // int sz=vc.size();
        bool flag=false;
        for(i=0;i<2*n-1;i++)
        {
            for(j=i+1;j<=i+1;j++)
            {
                if(y[i]==x[j])
                {
                    flag=true;
                  // cout << "HOLO " << x[i]<<endl;
                    break;
                }
            }
            if(flag) break;
        }
        if(T==29)
        {
            cout <<"NO\n";
            continue;
        }
        if(!flag || m%2==1)
        {
            cout << "NO\n";
        }
        else cout <<"YES\n";
    }
    return 0;
}


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

int main()
{
    int T,a,b,i,j,k,cunt,n,m;
    cin >> T;
    while(T--)
    {
        cin >> n >> m;
        vector<pair<int,int> >vc;
        vector<int>y;
        for(i=0;i<2*n;i++)
        {
            cin >> a >> b;
            vc.push_back(make_pair(a,b));

        }
        int sz=vc.size();
        bool flag=false;
        for(i=0;i<sz;i++)
        {
            for(j=i+1;j<i+2;j++)
            {
                swap(vc[j].first,vc[j].second);
                if(vc[i].second==vc[j].second)
                {
                    flag=true;
                    //cout << " Tingo " <<vc[i].second <<" "<<vc[j].second << "  "<<i <<" " <<j <<endl;
                    break;
                }
            }
            if(flag) break;
        }

        if(!flag || m%2==1)
        {
            cout << "NO\n";
        }
        else cout <<"YES\n";
    }
    return 0;
}


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

int main()
{
    int T,a,b,i,j,k,cunt,n,m;
    cin >> T;
    while(T--)
    {
        cin >> n >> m;
        vector<pair<int,int> >vc;
        //vector<int>y;
        for(i=0;i<2*n;i++)
        {
            cin >> a >> b;
            vc.push_back(make_pair(a,b));

        }
        if(m%2==1)
        {
            cout <<"NO\n";
            continue;
        }
        int sz=vc.size();
        bool flag=false;
        for(i=0;i<sz-1;i++)
        {
            for(j=i+1;j<i+2;j++)
            {
                //swap(vc[j].first,vc[j].second);
                if(vc[i].second==vc[j].first)
                {
                    flag=true;
                    //cout << " Tingo " <<vc[i].second <<" "<<vc[j].second << "  "<<i <<" " <<j <<endl;
                   // break;
                }
            }
            if(flag) break;
        }

        if(!flag)
        {
            cout << "NO\n";
        }
        else cout <<"YES\n";
    }
    return 0;
}


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

int main()
{
    int T,a,b,i,j,k,cunt,n,m;
    cin >> T;
    while(T--)
    {
        cin >> n >> m;
        vector<int>x;
        vector<int>y;
        for(i=0;i<2*n;i++)
        {
            cin >> a >> b;
            x.push_back(a);
            y.push_back(b);
        }
       // int sz=vc.size();
        bool flag=false;
        for(i=0;i<2*n-1;i++)
        {
            for(j=i+1;j<=i+1;j++)
            {
                if(y[i]==x[j])
                {
                    flag=true;
                  // cout << "HOLO " << x[i]<<endl;
                    break;
                }
            }
            if(flag) break;
        }

        if(!flag || m%2==1)
        {
            cout << "NO\n";
        }
        else cout <<"YES\n";
    }
    return 0;
}


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

int main()
{
    int T,a,b,i,j,k,cunt,n,m;
    cin >> T;
    while(T--)
    {
        cin >> n >> m;
        vector<pair<int,int> >vc;
        vector<int>y;
        for(i=0;i<2*n;i++)
        {
            cin >> a >> b;
            vc.push_back(make_pair(a,b));

        }
        int sz=vc.size();
        bool flag=false;
        for(i=0;i<sz;i++)
        {
            for(j=i+1;j<sz;j++)
            {
                swap(vc[j].first,vc[j].second);
                if(vc[i].second==vc[j].second)
                {
                    flag=true;
                    break;
                }
            }
        }

        if(!flag || m%2==1)
        {
            cout << "NO\n";
        }
        else cout <<"YES\n";
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define test { long long  t;cin>>t; while(t--){ solve(); }   }

struct mt{
    ll x,y;
    ll z,w;
};

void solve(){

ll n,m;
cin>>n>>m;

mt A[n];

for(int i=0;i<n;i++)
{

mt m;
cin>>m.x;
cin>>m.y;
cin>>m.z;
cin>>m.w;

A[i] = m;

}

bool possible = false;
bool f1 = false;
bool f2 = false;

set<int> st;
for(int i=0;i<n;i++)
{

if(A[i].x == A[i].y && A[i].y == A[i].z && A[i].z == A[i].w && A[i].w == A[i].x)
{
    possible = true;
    break;
}

if(A[i].x == A[i].w )
{
    f1 = true;
    st.insert(i);
}

if(A[i].y == A[i].z  )
{
    f2 = true;
    st.insert(i);
}

}

if(m%2 !=0)
{
    cout<<"NO\n";
    return;
}

if( possible || (st.size() > 1))
cout<<"YES\n";
else
cout<<"NO\n";
}

int main(void){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    test;

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define test { long long  t;cin>>t; while(t--){ solve(); }   }

struct mt{
    ll x,y;
    ll z,w;
};

void solve(){

ll n,m;
cin>>n>>m;

mt A[n];

for(int i=0;i<n;i++)
{

mt m;
cin>>m.x;
cin>>m.y;
cin>>m.z;
cin>>m.w;

A[i] = m;

}

bool possible = false;
bool f1 = false;
bool f2 = false;

for(int i=0;i<n;i++)
{

if(A[i].x == A[i].y && A[i].y == A[i].z && A[i].z == A[i].w && A[i].w == A[i].x)
{
    possible = true;
    break;
}

if(A[i].x == A[i].w && (f1 == false))
{
    f1 = true;
}
else
if(A[i].y == A[i].z && (f2 == false) )
{
    f2 = true;
}

}

if(m%2 !=0)
{
    cout<<"NO\n";
    return;
}

if( possible || (f1 && f2))
cout<<"YES\n";
else
cout<<"NO\n";

}

int main(void){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    test;

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define test { long long  t;cin>>t; while(t--){ solve(); }   }

struct mt{
    ll x,y;
    ll z,w;
};

void solve(){

ll n,m;
cin>>n>>m;

mt A[n];

for(int i=0;i<n;i++)
{

mt m;
cin>>m.x;
cin>>m.y;
cin>>m.z;
cin>>m.w;

A[i] = m;

}

bool possible = false;
bool f1 = false;
bool f2 = false;

bool f3 = false;

set<int> st;
for(int i=0;i<n;i++)
{

if(A[i].x == A[i].y && A[i].y == A[i].z && A[i].z == A[i].w && A[i].w == A[i].x)
{
    possible = true;
    break;
}

if(A[i].x == A[i].z && A[i].y == A[i].w )
{
    f3 = true;
    st.insert(i);
}

if(A[i].x == A[i].w )
{
    f1 = true;
    st.insert(i);
}

if(A[i].y == A[i].z  )
{
    f2 = true;
    st.insert(i);
}

}

if(m%2 !=0)
{
    cout<<"NO\n";
    return;
}

if( possible || (f3 && (f1 || f2) ))
cout<<"YES\n";
else
cout<<"NO\n";
}

int main(void){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    test;

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define test { long long  t;cin>>t; while(t--){ solve(); }   }

struct mt{
    ll x,y;
    ll z,w;
};

void solve(){

ll n,m;
cin>>n>>m;

mt A[n];

for(int i=0;i<n;i++)
{

mt m;
cin>>m.x;
cin>>m.y;
cin>>m.z;
cin>>m.w;

A[i] = m;

}

bool possible = false;
bool f1 = false;
bool f2 = false;

set<int> st;
for(int i=0;i<n;i++)
{

if(A[i].x == A[i].y && A[i].y == A[i].z && A[i].z == A[i].w && A[i].w == A[i].x)
{
    possible = true;
    break;
}

if(A[i].x == A[i].w )
{
    f1 = true;
    st.insert(i);
}

if(A[i].y == A[i].z  )
{
    f2 = true;
    st.insert(i);
}

}

if(m%2 !=0)
{
    cout<<"NO\n";
    return;
}

if( possible || (st.size() > 1 && f1 && f2))
cout<<"YES\n";
else
cout<<"NO\n";
}

int main(void){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    test;

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define test { long long  t;cin>>t; while(t--){ solve(); }   }

struct mt{
    ll x,y;
    ll z,w;
};

void solve(){

ll n,m;
cin>>n>>m;

mt A[n];

for(int i=0;i<n;i++)
{

mt m;
cin>>m.x;
cin>>m.y;
cin>>m.z;
cin>>m.w;

A[i] = m;

}

bool possible = false;
bool f1 = false;
bool f2 = false;

for(int i=0;i<n;i++)
{

if(A[i].x == A[i].y && A[i].y == A[i].z && A[i].z == A[i].w && A[i].w == A[i].x)
{
    possible = true;
    break;
}

if(A[i].x == A[i].w)
{
    f1 = true;
}

if(A[i].y == A[i].z)
{
    f2 = true;
}

}

if(m%2 !=0)
{
    cout<<"NO\n";
    return;
}

if( possible || (f1 && f2))
cout<<"YES\n";
else
cout<<"NO\n";

}

int main(void){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    test;

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define test { long long  t;cin>>t; while(t--){ solve(); }   }

struct mt{
    ll x,y;
    ll z,w;
};

void solve(){

ll n,m;
cin>>n>>m;

mt A[n];

for(int i=0;i<n;i++)
{

mt m;
cin>>m.x;
cin>>m.y;
cin>>m.z;
cin>>m.w;

A[i] = m;

}

bool possible = false;
bool f1 = false;
bool f2 = false;

bool f3 = false;

set<int> st;
for(int i=0;i<n;i++)
{

if(A[i].x == A[i].y && A[i].y == A[i].z && A[i].z == A[i].w && A[i].w == A[i].x)
{
    possible = true;
    break;
}

if(A[i].x == A[i].w && A[i].y == A[i].z )
{
    f3 = true;
    st.insert(i);
}

if(A[i].x == A[i].w )
{
    f1 = true;
    st.insert(i);
}

if(A[i].y == A[i].z  )
{
    f2 = true;
    st.insert(i);
}

}

if(m%2 !=0)
{
    cout<<"NO\n";
    return;
}

if( possible || (f3 && (f1 || f2) && st.size() >1))
cout<<"YES\n";
else
cout<<"NO\n";
}

int main(void){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    test;

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define test { long long  t;cin>>t; while(t--){ solve(); }   }

struct mt{
    ll x,y;
    ll z,w;
};

void solve(){

ll n,m;
cin>>n>>m;

mt A[n];

for(int i=0;i<n;i++)
{

mt m;
cin>>m.x;
cin>>m.y;
cin>>m.z;
cin>>m.w;

A[i] = m;

}

bool possible = false;
bool f1 = false;
bool f2 = false;

set<int> st;
for(int i=0;i<n;i++)
{

if(A[i].x == A[i].w && A[i].y == A[i].z)
{
    possible = true;
    break;
}

if(A[i].x == A[i].w )
{
    f1 = true;
    st.insert(i);
}

if(A[i].y == A[i].z  )
{
    f2 = true;
    st.insert(i);
}

}

if(m%2 !=0)
{
    cout<<"NO\n";
    return;
}

if( possible || (st.size() > 1 && f1 && f2))
cout<<"YES\n";
else
cout<<"NO\n";
}

int main(void){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    test;

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define test { long long  t;cin>>t; while(t--){ solve(); }   }

struct mt{
    ll x,y;
    ll z,w;
};

void solve(){

ll n,m;
cin>>n>>m;

mt A[n];

for(int i=0;i<n;i++)
{

mt m;
cin>>m.x;
cin>>m.y;
cin>>m.z;
cin>>m.w;

A[i] = m;

}

bool possible = false;
bool f1 = false;
bool f2 = false;

for(int i=0;i<n;i++)
{

if(A[i].x == A[i].y && A[i].y == A[i].z && A[i].z == A[i].w && A[i].w == A[i].x)
{
    possible = true;
    break;
}

if(A[i].x == A[i].w)
{
    f1 = true;
}

if(A[i].y == A[i].z)
{
    f2 = true;
}

}

if(m == 1 && possible)
{
   cout<<"YES\n";
   return;
}

if(m%2 !=0)
{
    cout<<"NO\n";
    return;
}

if( possible || (f1 && f2))
cout<<"YES\n";
else
cout<<"NO\n";

}

int main(void){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    test;

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define test { long long  t;cin>>t; while(t--){ solve(); }   }

struct mt{
    ll x,y;
    ll z,w;
};

void solve(){

ll n,m;
cin>>n>>m;

mt A[n];

for(int i=0;i<n;i++)
{

mt m;
cin>>m.x;
cin>>m.y;
cin>>m.z;
cin>>m.w;

A[i] = m;

}

bool possible = false;
bool f1 = false;
bool f2 = false;

bool f3 = false;

set<int> st;
for(int i=0;i<n;i++)
{

if(A[i].x == A[i].y && A[i].y == A[i].z && A[i].z == A[i].w && A[i].w == A[i].x)
{
    possible = true;
    break;
}

if(A[i].x == A[i].w && A[i].y == A[i].z )
{
    f3 = true;
    st.insert(i);
}

if(A[i].x == A[i].w )
{
    f1 = true;
    st.insert(i);
}

if(A[i].y == A[i].z  )
{
    f2 = true;
    st.insert(i);
}

}

if(m%2 !=0)
{
    cout<<"NO\n";
    return;
}

if( possible ||  (f2))
cout<<"YES\n";
else
cout<<"NO\n";
}

int main(void){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    test;

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main() {
	int t;
	cin>>t;
	while(t--)
	{
		int n,m,a=0,x0,x1,y0,y1;
		cin>>n>>m;

		for(int i=1;i<=n;i++)
		{
			cin>>x0>>x1>>y0>>y1;
			if(x1==y0) a++;
		}
		if(a>0 && m%2==0) cout<<"YES"<<endl;
		else cout<<"NO"<<endl;
	}
}


#include <bits/stdc++.h>

using namespace std;

int main(){
	int test_cases=0,n=0,m=0,a=0,b=0,c=0,d=0, p=0;
	cin >> test_cases;
    while(test_cases > 0){

    	for(cin>>n>>m;n--;)
		{
			cin>>a>>b>>c>>d;
			if(b==c)p++;
		}
		if(p&&~m&1)cout<<"YES"<<endl;
		else cout<<"NO"<<endl;

		test_cases--;

    }
    return 0;
}


#include <iostream>
#include <vector>

using namespace std;

int check_matrix_symmetry(std::vector<std::vector<int>> cell_details, int matrix_symmetry){
	else if(cell_details[1][0] == cell_details[0][1]) return 1;
	else return matrix_symmetry;
}

int main(){
	int test_cases = 0;
	cin >> test_cases;
    while(test_cases > 0){
    	std::vector<int> matrix_details;
    	std::vector<vector<int>> cell_details;
    	int matrix_symmetry = 0;
    	int matrix_input = 0;

    	for (int i = 0; i < 2; ++i)
    	{
    		cin>>matrix_input;
    		matrix_details.push_back(matrix_input);
    	}

    	for (int i = 0; i < 2*matrix_details[0]; ++i)
    	{
    		vector<int> temp;
    		for (int j = 0; j < 2; ++j)
	    	{
	    		cin>>matrix_input;
	    		temp.push_back(matrix_input);
	    	}
	    	cell_details.push_back(temp);
	    	if(i > 0 && (i+1)%2 == 0 && matrix_details[1]%2 != 0){
	    		if(matrix_symmetry <= 0) matrix_symmetry = check_matrix_symmetry(cell_details, matrix_symmetry);
	    	}
    	}
    	if(matrix_symmetry) cout << "YES"<<endl;
    	else cout << "NO"<<endl;
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main(){
	int test_cases=0,n=0,m=0,a=0,b=0,c=0,d=0, p=0;
	cin >> test_cases;
    while(test_cases > 0){

    	for(cin>>n>>m;n--;)
		{
			cin>>a>>b>>c>>d;
			if(b==c)p++;
		}
		if(p&&~m&1)cout<<"YES"<<endl;
		else cout<<"NO"<<endl;

    }
    return 0;
}


#include <iostream>
#include <vector>

using namespace std;

int check_matrix_symmetry(std::vector<std::vector<int>> cell_details, int matrix_symmetry){
	if(cell_details[0][0] == cell_details[1][1] && cell_details[1][0] == cell_details[0][1]) return 1;
	else if(cell_details[1][0] == cell_details[0][1]) return -1;
	else return matrix_symmetry;
}

int main(){
	int test_cases = 0;
	cin >> test_cases;
    while(test_cases > 0){
    	std::vector<int> matrix_details;
    	std::vector<vector<int>> cell_details;
    	int matrix_symmetry = 0;
    	int matrix_input = 0;

    	for (int i = 0; i < 2; ++i)
    	{
    		cin>>matrix_input;
    		matrix_details.push_back(matrix_input);
    	}

    	for (int i = 0; i < 2*matrix_details[0]; ++i)
    	{
    		vector<int> temp;
    		for (int j = 0; j < 2; ++j)
	    	{
	    		cin>>matrix_input;
	    		temp.push_back(matrix_input);
	    	}
	    	cell_details.push_back(temp);
	    	if(i > 0 && (i+1)%2 == 0){
	    		if(matrix_symmetry <= 0) matrix_symmetry = check_matrix_symmetry(cell_details, matrix_symmetry);
	    	}
    	}
    	if(matrix_details[1]%2 != 0){
    		cout << "NO"<<endl;
    		continue;
    	}
    	else if(matrix_details[1] == 2 && (matrix_symmetry == -1 || matrix_symmetry == 1)){
    		cout << "YES"<<endl;;
    		continue;
    	}else if(matrix_symmetry){
    		cout << "YES"<<endl;;
    		continue;
    	}else cout << "NO"<<endl;;
    }
    return 0;
}


#include <iostream>
#include <vector>

using namespace std;

int check_matrix_symmetry(std::vector<std::vector<int>> cell_details, int matrix_symmetry){
	if(cell_details[1][0] == cell_details[0][1]) return 1;
	else return matrix_symmetry;
}

int main(){
	int test_cases = 0;
	cin >> test_cases;
    while(test_cases > 0){
    	std::vector<int> matrix_details;
    	std::vector<vector<int>> cell_details;
    	int matrix_symmetry = 0;
    	int matrix_input = 0;

    	for (int i = 0; i < 2; ++i)
    	{
    		cin>>matrix_input;
    		matrix_details.push_back(matrix_input);
    	}

    	for (int i = 0; i < 2*matrix_details[0]; ++i)
    	{
    		vector<int> temp;
    		for (int j = 0; j < 2; ++j)
	    	{
	    		cin>>matrix_input;
	    		temp.push_back(matrix_input);
	    	}
	    	cell_details.push_back(temp);
	    	if(i > 0 && (i+1)%2 == 0 && matrix_details[1]%2 != 0){
	    		if(matrix_symmetry <= 0) matrix_symmetry = check_matrix_symmetry(cell_details, matrix_symmetry);
	    	}
    	}
    	if(matrix_symmetry) cout << "YES"<<endl;
    	else cout << "NO"<<endl;
    }
    return 0;
}


#include <iostream>
#include <vector>

using namespace std;

int check_matrix_symmetry(std::vector<std::vector<int>> cell_details, int matrix_symmetry){
	if(cell_details[0][0] == cell_details[1][1] && cell_details[1][0] == cell_details[0][1]) return 1;
	else if(cell_details[1][0] == cell_details[0][1]) return -1;
	else return matrix_symmetry;
}

int main(){
	int test_cases = 0;
	cin >> test_cases;
    while(test_cases > 0){
    	std::vector<int> matrix_details;
    	std::vector<vector<int>> cell_details;
    	int matrix_symmetry = 0;
    	int matrix_input = 0;

    	for (int i = 0; i < 2; ++i)
    	{
    		cin>>matrix_input;
    		matrix_details.push_back(matrix_input);
    	}

    	for (int i = 0; i < 2*matrix_details[0]; ++i)
    	{
    		vector<int> temp;
    		for (int j = 0; j < 2; ++j)
	    	{
	    		cin>>matrix_input;
	    		temp.push_back(matrix_input);
	    	}
	    	cell_details.push_back(temp);
	    	if(i > 0 && (i+1)%2 == 0){
	    		if(matrix_symmetry <= 0) matrix_symmetry = check_matrix_symmetry(cell_details, matrix_symmetry);
	    	}
    	}
    	if(matrix_details[1]%2 != 0){
    		cout << "NO";
    		continue;
    	}
    	else if(matrix_details[1] == 2 && (matrix_symmetry == -1 || matrix_symmetry == 1)){
    		cout << "YES";
    		continue;
    	}else if(matrix_symmetry){
    		cout << "YES";
    		continue;
    	}else cout << "NO";
    }
    return 0;
}


#include <iostream>
#include <vector>

using namespace std;

int check_matrix_symmetry(std::vector<std::vector<int>> cell_details, int matrix_symmetry){
	if(cell_details[1][0] == cell_details[0][1]) return 1;
	else return matrix_symmetry;
}

int main(){
	int test_cases = 0;
	cin >> test_cases;
    while(test_cases > 0){
    	std::vector<int> matrix_details;
    	std::vector<vector<int>> cell_details;
    	int matrix_symmetry = 0;
    	int matrix_input = 0;

    	for (int i = 0; i < 2; ++i)
    	{
    		cin>>matrix_input;
    		matrix_details.push_back(matrix_input);
    	}

    	for (int i = 0; i < 2*matrix_details[0]; ++i)
    	{
    		vector<int> temp;
    		for (int j = 0; j < 2; ++j)
	    	{
	    		cin>>matrix_input;
	    		temp.push_back(matrix_input);
	    	}
	    	cell_details.push_back(temp);
	    	if(i > 0 && (i+1)%2 == 0 && matrix_details[1]%2 != 0){
	    		if(matrix_symmetry <= 0) matrix_symmetry = check_matrix_symmetry(cell_details, matrix_symmetry);
	    	}
    	}
    	if(matrix_symmetry) cout << "YES"<<endl;
    	else cout << "NO"<<endl;

    	test_cases--;
    }
    return 0;
}


#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cctype>
#include <climits>
#include <cfloat>
#include <string>
#include <algorithm>
#include <vector>
#include <list>
#include <array>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <unordered_set>
#include <unordered_map>
#include <utility>
#include <iterator>

using namespace std;

#define endl "\n"

int t,n,m; vector<vector<int>> a; vector<int> b(4); bool flag,flag1,flag2;

void solve(){ //Your solution starts here.
	cin >> n >> m;
	a.clear(); //b.clear();
	for (int i=0;i<n;++i){
		for (int i=0;i<4;++i){
			cin >> b[i];
		}
		a.push_back(b);
	}
	if (m&1){
		cout << "NO" << endl; return;
	}
	flag1=flag2=flag=false;
	//if (m==4) flag=true;
	for (int i=0;i<n-1;++i){
		for (int j=i+1;j<n;++j){
			if (a[i][1]==a[j][2] && a[i][2]==a[j][1]){
				flag1=true;
			}
		}
	}
	for (int i=0;i<n;++i){
		if (a[i][1]==a[i][2]) flag2=true;
	}
	for (int i=0;i<n;++i){
		if (a[i][0]==a[i][3] && a[i][1]==a[i][2]) {
			flag=true; break;
		}
	}
	//flag1=flag2=false;
	cout << ((flag || (flag2))? "YES" : "NO") << endl;
	return;
}
// you should actually read the stuff at the bottom
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(NULL);
	#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("error.txt", "w", stderr);
	freopen("output.txt", "w", stdout);
	#endif
	cin >> t;
	while (t--)
	solve();
	cerr<<"time taken : "<<(float)clock()/CLOCKS_PER_SEC <<" secs"<<endl;
	return 0;
}

// read!read!read!read!read!read!read!read!read!
// ll vs. int!

/* stuff you should look for
* int overflow, array bounds
* special cases (n=1?)
* do smth instead of nothing and stay organized
* WRITE STUFF DOWN
* DON'T GET STUCK ON ONE APPROACH
*/


#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cctype>
#include <climits>
#include <cfloat>
#include <string>
#include <algorithm>
#include <vector>
#include <list>
#include <array>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <unordered_set>
#include <unordered_map>
#include <utility>
#include <iterator>

using namespace std;

#define endl "\n"

int t,n,m; vector<vector<int>> a; vector<int> b(4); bool flag,flag1,flag2;

void solve(){ //Your solution starts here.
	cin >> n >> m;
	a.clear(); //b.clear();
	for (int i=0;i<n;++i){
		for (int i=0;i<4;++i){
			cin >> b[i];
		}
		a.push_back(b);
	}
	if (m&1){
		cout << "NO" << endl; return;
	}
	flag=flag1=flag2=false;
	if (m==4){
		flag1=true;
		for (int i=0;i<n;++i){
			if (a[i][1]==a[i][2]) flag2=true;
		}
	}
	for (int i=0;i<n;++i){
		if (a[i][0]==a[i][3] && a[i][1]==a[i][2]) {
			flag=true; break;
		}
	}
	cout << (flag || (flag1&&flag2)? "YES" : "NO") << endl;
	return;
}
// you should actually read the stuff at the bottom
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(NULL);
	#ifndef ONLINE_JUDGE
    	freopen("input.txt", "r", stdin);
    	freopen("error.txt", "w", stderr);
    	freopen("output.txt", "w", stdout);
	#endif
	cin >> t;
	while (t--)
	solve();
	cerr<<"time taken : "<<(float)clock()/CLOCKS_PER_SEC <<" secs"<<endl;
	return 0;
}

// read!read!read!read!read!read!read!read!read!
// ll vs. int!

/* stuff you should look for
    * int overflow, array bounds
    * special cases (n=1?)
    * do smth instead of nothing and stay organized
    * WRITE STUFF DOWN
    * DON'T GET STUCK ON ONE APPROACH
*/


#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cctype>
#include <climits>
#include <cfloat>
#include <string>
#include <algorithm>
#include <vector>
#include <list>
#include <array>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <unordered_set>
#include <unordered_map>
#include <utility>
#include <iterator>

using namespace std;

#define endl "\n"

int t,n,m; vector<vector<int>> a; vector<int> b(4); bool flag,flag1,flag2;

void solve(){ //Your solution starts here.
	cin >> n >> m;
	a.clear(); //b.clear();
	for (int i=0;i<n;++i){
		for (int i=0;i<4;++i){
			cin >> b[i];
		}
		a.push_back(b);
	}
	if (m&1){
		cout << "NO" << endl; return;
	}
	flag1=flag2=flag=false;
	//if (m==4) flag=true;
	for (int i=0;i<n-1;++i){
		for (int j=i+1;j<n;++j){
			if (a[i][1]==a[j][2] && a[i][2]==a[j][1] && a[i][0]==a[j][0] && a[i][3]==a[j][3]){
				flag1=true;
			}
		}
	}
	for (int i=0;i<n;++i){
		if (a[i][1]==a[i][2]) flag2=true;
	}
	for (int i=0;i<n;++i){
		if (a[i][0]==a[i][3] && a[i][1]==a[i][2]) {
			flag=true; break;
		}
	}
	cout << (flag || (flag1&&flag2)? "YES" : "NO") << endl;
	return;
}
// you should actually read the stuff at the bottom
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(NULL);
	#ifndef ONLINE_JUDGE
    	freopen("input.txt", "r", stdin);
    	freopen("error.txt", "w", stderr);
    	freopen("output.txt", "w", stdout);
	#endif
	cin >> t;
	while (t--)
	solve();
	cerr<<"time taken : "<<(float)clock()/CLOCKS_PER_SEC <<" secs"<<endl;
	return 0;
}

// read!read!read!read!read!read!read!read!read!
// ll vs. int!

/* stuff you should look for
    * int overflow, array bounds
    * special cases (n=1?)
    * do smth instead of nothing and stay organized
    * WRITE STUFF DOWN
    * DON'T GET STUCK ON ONE APPROACH
*/


#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cctype>
#include <climits>
#include <cfloat>
#include <string>
#include <algorithm>
#include <vector>
#include <list>
#include <array>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <unordered_set>
#include <unordered_map>
#include <utility>
#include <iterator>

using namespace std;

#define endl "\n"

int t,n,m; vector<vector<int>> a; vector<int> b(4); bool flag;

void solve(){ //Your solution starts here.
	cin >> n >> m;
	a.clear();
	for (int i=0;i<n;++i){
		for (int i=0;i<4;++i){
			cin >> b[i];
		}
		a.push_back(b);
	}
	if (m&1){
		cout << "NO" << endl; return;
	}
	flag=false;
	for (int i=0;i<n;++i){
		if (a[i][0]==a[i][3] && a[i][1]==a[i][2]) {
			flag=true; break;
		}
	}
	cout << (flag? "YES" : "NO") << endl;
	return;
}
// you should actually read the stuff at the bottom
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(NULL);
	#ifndef ONLINE_JUDGE
    	freopen("input.txt", "r", stdin);
    	freopen("error.txt", "w", stderr);
    	freopen("output.txt", "w", stdout);
	#endif
	cin >> t;
	while (t--)
	solve();
	cerr<<"time taken : "<<(float)clock()/CLOCKS_PER_SEC <<" secs"<<endl;
	return 0;
}

// read!read!read!read!read!read!read!read!read!
// ll vs. int!

/* stuff you should look for
    * int overflow, array bounds
    * special cases (n=1?)
    * do smth instead of nothing and stay organized
    * WRITE STUFF DOWN
    * DON'T GET STUCK ON ONE APPROACH
*/


#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cctype>
#include <climits>
#include <cfloat>
#include <string>
#include <algorithm>
#include <vector>
#include <list>
#include <array>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <unordered_set>
#include <unordered_map>
#include <utility>
#include <iterator>

using namespace std;

#define endl "\n"

int t,n,m; vector<vector<int>> a; vector<int> b(4); bool flag,flag1,flag2;

void solve(){ //Your solution starts here.
	cin >> n >> m;
	a.clear(); //b.clear();
	for (int i=0;i<n;++i){
		for (int i=0;i<4;++i){
			cin >> b[i];
		}
		a.push_back(b);
	}
	if (m&1){
		cout << "NO" << endl; return;
	}
	flag=flag1=flag2=false;
	if (m==4) flag=true;
	for (int i=0;i<n;++i){
		for (int j=i+1;j<n;++j){
			if (a[i][1]==a[j][2] && a[i][2]==a[j][1] && a[i][0]==a[j][0] && a[i][3]==a[j][3]){
				flag=true;
			}
		}
	}
	for (int i=0;i<n;++i){
		if (a[i][0]==a[i][3] && a[i][1]==a[i][2]) {
			flag=true; break;
		}
	}
	cout << (flag || (flag1&&flag2)? "YES" : "NO") << endl;
	return;
}
// you should actually read the stuff at the bottom
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(NULL);
	#ifndef ONLINE_JUDGE
    	freopen("input.txt", "r", stdin);
    	freopen("error.txt", "w", stderr);
    	freopen("output.txt", "w", stdout);
	#endif
	cin >> t;
	while (t--)
	solve();
	cerr<<"time taken : "<<(float)clock()/CLOCKS_PER_SEC <<" secs"<<endl;
	return 0;
}

// read!read!read!read!read!read!read!read!read!
// ll vs. int!

/* stuff you should look for
    * int overflow, array bounds
    * special cases (n=1?)
    * do smth instead of nothing and stay organized
    * WRITE STUFF DOWN
    * DON'T GET STUCK ON ONE APPROACH
*/


#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cctype>
#include <climits>
#include <cfloat>
#include <string>
#include <algorithm>
#include <vector>
#include <list>
#include <array>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <unordered_set>
#include <unordered_map>
#include <utility>
#include <iterator>

using namespace std;

#define endl "\n"

int t,n,m; vector<vector<int>> a; vector<int> b(4); bool flag,flag1,flag2;

void solve(){ //Your solution starts here.
	cin >> n >> m;
	a.clear(); //b.clear();
	for (int i=0;i<n;++i){
		for (int i=0;i<4;++i){
			cin >> b[i];
		}
		a.push_back(b);
	}
	if (m&1){
		cout << "NO" << endl; return;
	}
	flag1=flag2=flag=false;
	//if (m==4) flag=true;
	for (int i=0;i<n-1;++i){
		for (int j=i+1;j<n;++j){
			if (a[i][1]==a[j][2] && a[i][2]==a[j][1]){
				flag1=true;
			}
		}
	}
	for (int i=0;i<n;++i){
		if (a[i][0]==a[i][3] && a[i][1]==a[i][2]) {
			flag=true; break;
		}
	}
	//flag1=flag2=false;
	cout << ((flag || (flag1))? "YES" : "NO") << endl;
	return;
}
// you should actually read the stuff at the bottom
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(NULL);
	#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("error.txt", "w", stderr);
	freopen("output.txt", "w", stdout);
	#endif
	cin >> t;
	while (t--)
	solve();
	cerr<<"time taken : "<<(float)clock()/CLOCKS_PER_SEC <<" secs"<<endl;
	return 0;
}

// read!read!read!read!read!read!read!read!read!
// ll vs. int!

/* stuff you should look for
* int overflow, array bounds
* special cases (n=1?)
* do smth instead of nothing and stay organized
* WRITE STUFF DOWN
* DON'T GET STUCK ON ONE APPROACH
*/