#include<bits/stdc++.h>
#define maxn 1005
using namespace std;
int n,Ques;
vector<int> v[maxn];
int size[maxn],dfn[maxn],pos[maxn],vis[maxn],fa[maxn],son[maxn],top[maxn],dep[maxn];
int cnt=0;
void Dfs(int x)
{
size[x]=1;//首先以x为根的子树的大小size 先设为1 就是目前已x为根的子树只有x自己
for(int i=0;i<v[x].size();i++)
{
int y=v[x][i];//son
if(!size[y])//这里的意思其实就是如果这个儿子还没有访问过
//因为我们可以看到每一次dfs的开始才会把size设一个数值 一开始应该都是0的
//所以这里就可以直接当做一个vis标记用了
{
dep[y]=dep[x]+1;//记录深度 son的深度 是father的深度+1
fa[y]=x;//记录son的father 是谁
Dfs(y);
size[x]+=size[y];//更新x为根的子树的大小
if(size[son[x]]<size[y])//son存储的是重儿子
son[x]=y;//更新重儿子
}
}
}
void Dfs(int x,int tp)
{
top[x]=tp;//top数组是用来记录一条重链的顶端
dfn[++cnt]=x;//dfn是记录第cnt个访问的点是x
pos[x]=cnt;//pos记录第x个点是第cnt个访问的 当然在本题中不会用到
if(son[x])//如果有重儿子 先走重儿子
Dfs(son[x],tp);
for(int i=0;i<v[x].size();i++)
{
int y=v[x][i];
if(!top[y])//走轻儿子
Dfs(y,y);
}
}
int lca(int x,int y)
{
while(top[x]!=top[y])//先跳到同一条重链上
{
if(dep[top[x]]<dep[top[y]])
swap(x,y);
x=fa[top[x]];
}
if(dep[x]>dep[y])//保证x的深度更小 x就是lca
swap(x,y);
return x;
}
inline int read()
{
int X=0; bool flag=1; char ch=getchar();
while(ch<'0'||ch>'9') {if(ch=='-') flag=0; ch=getchar();}
while(ch>='0'&&ch<='9') {X=(X<<1)+(X<<3)+ch-'0'; ch=getchar();}
if(flag) return X;
return ~(X-1);
}
int main()
{
freopen("asm_virus.in","r",stdin);
freopen("asm_virus.out","w",stdout);
n=read(),Ques=read();
for(int i=1,x,y;i<n;i++)
{
x=read(),y=read();
v[x].push_back(y);
v[y].push_back(x);
}
Dfs(1);Dfs(1,1);
for(int i=1,x,y,u,v;i<=Ques;i++)
{
x=read(),y=read(),u=read(),v=read();
int lca1=lca(x,y),lca2=lca(u,v);
if(dep[lca1]<dep[lca2]) swap(lca1,lca2),swap(x,u),swap(y,v);
if(lca(lca1,u)==lca1||lca(lca1,v)==lca1)
puts("YES");
else
puts("NO");
}
return 0;
}