Problem: In Homer's country, there are n cities numbered 1 to n and they form a tree. That is, there are (n-1) undirected roads between these n cities and every two cities can reach each other through these roads. 

Homer's country is an industrial country, and each of the n cities in it contains some mineral resource. The mineral resource of city i is labeled a_i. 

Homer is given the plans of the country in the following q years. The plan of the i-th year is described by four parameters u_i, v_i, l_i and r_i, and he is asked to find any mineral resource c_i such that the following two conditions hold: 

  * mineral resource c_i appears an odd number of times between city u_i and city v_i; and 
  * l_i ≤ c_i ≤ r_i. 



As the best friend of Homer, he asks you for help. For every plan, find any such mineral resource c_i, or tell him that there doesn't exist one.

Input

The first line contains two integers n (1 ≤ n ≤ 3 ⋅ 10^5) and q (1 ≤ q ≤ 3 ⋅ 10^5), indicating the number of cities and the number of plans.

The second line contains n integers a_1, a_2, ..., a_n (1 ≤ a_i ≤ n).

Then the i-th line of the following (n-1) lines contains two integers x_i and y_i (1 ≤ x_i, y_i ≤ n) with x_i ≠ y_i, indicating that there is a bidirectional road between city x_i and city y_i. It is guaranteed that the given roads form a tree.

Then the i-th line of the following q lines contains four integers u_i, v_i, l_i, r_i (1 ≤ u_i ≤ n, 1 ≤ v_i ≤ n, 1 ≤ l_i ≤ r_i ≤ n), indicating the plan of the i-th year.

Output

Print q lines, the i-th of which contains an integer c_i such that 

  * c_i = {-1} if there is no such mineral resource that meets the required condition; or 
  * c_i is the label of the chosen mineral resource of the i-th year. The chosen mineral resource c_i should meet those conditions in the i-th year described above in the problem statement. If there are multiple choices of c_i, you can print any of them. 

Example

Input


6 8
3 2 1 3 1 3
1 2
1 3
2 4
2 5
4 6
3 5 1 1
3 5 1 3
3 5 1 3
1 1 2 2
1 1 3 3
1 4 1 5
1 6 1 3
1 6 1 3


Output


-1
2
3
-1
3
2
2
3

Note

In the first three queries, there are four cities between city 3 and city 5, which are city 1, city 2, city 3 and city 5. The mineral resources appear in them are mineral resources 1 (appears in city 3 and city 5), 2 (appears in city 2) and 3 (appears in city 1). It is noted that 

  * The first query is only to check whether mineral source 1 appears an odd number of times between city 3 and city 5. The answer is no, because mineral source 1 appears twice (an even number of times) between city 3 and city 5. 
  * The second and the third queries are the same but they can choose different mineral resources. Both mineral resources 2 and 3 are available. 

Solution (in CPP):

Solution:
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cstdlib>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
int n,m,x,y,z,l,r,a[300005];
int rt[300005],ls[12000005],rs[12000005],tot;
ull c[300005],val[12000005];
int head[300005],to[600005],nex[600005],cnt;
int fa[300005][19],dep[300005];
inline ull rd(){
	ull res=0;
	for(int i=0;i<=60;i+=15)
		res^=(ull)rand()<<i;
	return res;
}
void modify(int &u,int v,int l,int r,int x,ull y){
	u=++tot;
	ls[u]=ls[v];rs[u]=rs[v];val[u]=val[v]^y;
	if(l<r){
		int mid=(l+r)>>1;
		if(x<=mid)modify(ls[u],ls[v],l,mid,x,y);
		else modify(rs[u],rs[v],mid+1,r,x,y);
	}
}
int query(int u1,int u2,int u3,int u4,int l,int r,int x,int y){
	if(!(val[u1]^val[u2]^val[u3]^val[u4]))return -1;
	if(l==r)return l;
	int mid=(l+r)>>1,res=-1;
	if(x<=mid)res=query(ls[u1],ls[u2],ls[u3],ls[u4],l,mid,x,y);
	if(~res)return res;
	if(y>mid)res=query(rs[u1],rs[u2],rs[u3],rs[u4],mid+1,r,x,y);
	return res;
}
inline void adde(int f,int t){
	to[++cnt]=t;
	nex[cnt]=head[f];
	head[f]=cnt;
}
void dfs(int u,int pre){
	fa[u][0]=pre;dep[u]=dep[pre]+1;
	for(int i=1;i<=18;++i)
		fa[u][i]=fa[fa[u][i-1]][i-1];
	modify(rt[u],rt[pre],1,n,a[u],c[a[u]]);
	for(int i=head[u],v;i;i=nex[i]){
		v=to[i];
		if(v==pre)continue;
		dfs(v,u);
	}
}
inline int lca(int x,int y){
	if(dep[x]<dep[y])swap(x,y);
	int t=dep[x]-dep[y];
	for(int i=0;i<=18;++i)
		if((t>>i)&1)x=fa[x][i];
	if(x==y)return x;
	for(int i=18;~i;--i){
		if(fa[x][i]!=fa[y][i]){
			x=fa[x][i];
			y=fa[y][i];
		}
	}
	return fa[x][0];
}
int main(){
	srand(19491001);
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;++i){
		scanf("%d",a+i);
		c[i]=rd();
	}
	for(int i=1;i<n;++i){
		scanf("%d%d",&x,&y);
		adde(x,y);adde(y,x);
	}
	dfs(1,0);
	while(m--){
		scanf("%d%d%d%d",&x,&y,&l,&r);
		z=lca(x,y);
		printf("%d\n",query(rt[x],rt[y],rt[z],rt[fa[z][0]],1,n,l,r));
	}
	return 0;
}