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. 
﻿//#pragma GCC optimize("sse,sse2,sse3,ssse3,sse4,sse4.1,sse4.2,abm,mmx,avx,avx2,popcnt,tune=native")
// #define _CRT_SECURE_NO_WARNINGS
//#include <chrono>
///#pragma comment(linker, "/STACK:160777216")
#include <set>
#include <map>
#include <deque>
#include <string>
#include <cstdint>
#include <cmath>
#include <queue>
#include <cassert>
#include <random>
#include <bitset>
#include <iomanip>
#include <cstring>
#include <numeric>
#include <time.h>//////////////
#include <ctime>
#include <climits>
#include <cstdio>
#include <vector>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <unordered_map>
#include <complex>
#include <chrono>
#include <unordered_set>
//++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++
//#define endl '\n'
#define mp make_pair
#define pbc push_back
#define pob pop_back()
#define empb emplace_back
#define queuel queue<long long>
#define sqr(a) ((a) * (a))
#define lsqr(a) (ld(a) * a)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pin(p) cin >> p.first >> p.second;
#define uniq(a) sort(all(a));(a).resize(unique(all(a)) - a.begin());
#define rev(v) reverse(v.begin(), v.end());
#define sout(s, c) for (auto i : s) cout << i << c;
#define pout(p) cout << p.first << " " << p.second;
#define er(v, l, r) erase(v.begin() + l, v.begin() + r);
#define vin(v) for (ll i = 0; i < v.size(); ++i) cin >> v[i];
#define vout(v, c) for (int i = 0; i < v.size(); ++i) cout << v[i] << c;
#define pushi(v, a) for (int i = 0; i < a.size(); ++i) v.push_back(a[i]);
#define fastio() ios_base::sync_with_stdio(0); cout.tie(0); cin.tie(0); srand(time(NULL))
#define dab(v) for(auto i:v)cout<<i<<' ';
#define sp system("pause")
//++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++

	typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
using namespace std;
typedef complex<double> cd;
//++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++
const int inf = 1e9;
const ll INF = 1e18;
const ld PI = acos(-1);
const ld EPS = 1e-9;
int mod = 998244353;
const int MOD7 = 1000000007;
const int MOD9 = 1000000009;

const int MAXN = 3e5 + 228;

int tin[MAXN];
int tout[MAXN];
const int bsz = 600;
vector<int> g[MAXN];
const int lgg = 19;
int up[MAXN][lgg];
int tl = 0;
int order[MAXN << 1];
void dfs(int v, int p)
{
	up[v][0] = p;
	for (int i = 1; i < lgg; ++i) up[v][i] = up[up[v][i - 1]][i - 1];
	order[tl] = v;
	tin[v] = tl++;
	for (int i : g[v])
	{
		if (i != p)
		{
			dfs(i, v);
		}
	}
	order[tl] = v;
	tout[v] = tl++;
}
bool pp(int a, int b)
{
	return tin[a] <= tin[b] && tout[a] >= tout[b];
}
int lca(int a, int b)
{
	if (pp(a, b)) return a;
	if (pp(b, a)) return b;
	for (int i = lgg - 1; i >= 0; --i)
	{
		if (!pp(up[a][i], b)) a = up[a][i];
	}
	return up[a][0];
}
int a[MAXN];
int cnt[MAXN];
int n, q;
int cntblock[MAXN / bsz + 190];
struct query
{
	int ml, mr, ql, qr, id, f;
};
bool cmp(query a, query b)
{
	if (a.ml / bsz == b.ml / bsz) return a.mr < b.mr;
	return a.ml < b.ml;
}
void add(int v)
{
	cnt[a[v]] ^= 1;
	if (cnt[a[v]]) cntblock[a[v] / bsz]++;
	else cntblock[a[v] / bsz]--;
}
int get(int l, int r)
{
	int i = l;
	for (i = l; i % bsz && i <=r; ++i)
	{
		if (cnt[i]) return i;
	}
	if (i > r) return -1;
	while (i / bsz != r / bsz)
	{
		if (cntblock[i / bsz])
		{
			for (int j = i; j < i + bsz; ++j)
			{
				if (cnt[j]) return j;
			}
		}
		i += bsz;
	}
	for (; i <= r; ++i)
	{
		if (cnt[i]) return i;
	}
	return -1;
}
signed main()
{
	fastio(); 
	cin >> n >> q;
	for (int i = 1; i <= n; ++i)
	{
		cin >> a[i];
	}
	for (int i = 0; i < n - 1; ++i)
	{
		int a, b;
		cin >> a >> b;
		g[a].pbc(b);
		g[b].pbc(a);
	}dfs(1, 1);
	vector<query> queries;
	for (int i = 0; i < q; ++i)
	{
		int a, b, l, r;
		cin >> a >> b >> l >> r;
		int x = lca(a, b);
		if (tin[a] > tin[b])swap(a, b);
		if (x == a)
		{
			queries.pbc({ tin[a],tin[b], l,r,i, 0 });
			continue;
		}
		queries.pbc({ tout[a], tin[b], l,r,i, x});

	}
	sort(all(queries), cmp);
	vector<int> ans(q);
	int l = 0, r = -1;
	for (auto i : queries)
	{
		while (l > i.ml) add(order[--l]);
		while (l < i.ml) add(order[l++]);
		while (r > i.mr) add(order[r--]);
		while (r < i.mr) add(order[++r]);
		if (i.f) add(i.f);
		ans[i.id] = get(i.ql, i.qr);
		if (i.f) add(i.f);
	}
	for (int i = 0; i < q; ++i)
	{
		cout << ans[i] << '\n';
	}
//	sp;
}