#include<bits/stdc++.h>
using namespace std;
struct people
{
int height;
int weight;
int age;
people(int hh,int ww,int aa)
{
height = hh;
weight = ww;
age = aa;
}
bool operator <(const people &rhs)const
{
if(height != rhs.height) return height<rhs.height;
if(weight != rhs.weight) return weight<rhs.weight;
return age<rhs.age;//if(age != rhs.age) return age<rhs.age;则错误
}
};
set<people> s;
int main()
{
int n,m,h,w,age;
cin>>n>>m;
for(int i=0;i<n;++i){
cin>>h>>w>>age;
s.insert(people(h,w,age));
}
for(int i=0;i<m;++i)
{
cin>>h>>w>>age;
if(s.count(people(h,w,age)))
{
cout<<"yes"<<endl;
}
else {
cout<<"no"<<endl;
//printf("%d %d %d",h,w,age);
}
}
return 0;
}