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 JAVA):

Solution:
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.util.Random;
import java.util.InputMismatchException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Stream;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        DOddMineralResource solver = new DOddMineralResource();
        solver.solve(1, in, out);
        out.close();
    }

    static class DOddMineralResource {
        long getValue(DOddMineralResource.Node node) {
            return node == null ? 0L : node.xor;
        }

        DOddMineralResource.Node getLeft(DOddMineralResource.Node node) {
            return node == null ? null : node.left;
        }

        DOddMineralResource.Node getRight(DOddMineralResource.Node node) {
            return node == null ? null : node.right;
        }

        long xor(int from, int to, DOddMineralResource.Node root, int left, int right) {
            if (from > right || left > to || root == null)
                return 0;
            if (from <= left && right <= to)
                return root.xor;
            int mid = (left + right) >> 1;
            return xor(from, to, getLeft(root), left, mid) + xor(from, to, getRight(root), mid + 1, right);
        }

        DOddMineralResource.Node update(int pos, long value, DOddMineralResource.Node root, int left, int right) {
            if (left == right)
                return new DOddMineralResource.Node(getValue(root) ^ value);
            int mid = (left + right) >> 1;
            return pos <= mid ? new DOddMineralResource.Node(update(pos, value, getLeft(root), left, mid), getRight(root))
                    : new DOddMineralResource.Node(getLeft(root), update(pos, value, getRight(root), mid + 1, right));
        }

        void make(DOddMineralResource.Node[] nodes, int[] a, long[] vals, int node, int parent, List<Integer>[] tree) {
            for (int child : tree[node])
                if (child != parent) {
                    nodes[child] = update(a[child], vals[a[child]], nodes[node], 1, nodes.length);
                    make(nodes, a, vals, child, node, tree);
                }
        }

        int getFirst(DOddMineralResource.Node X, DOddMineralResource.Node Y, int x, long V, int left, int right, int l) {
            long value = getValue(X) ^ getValue(Y);
            if (x >= left && x <= right) value ^= V;
            if (value == 0) return Integer.MAX_VALUE;
            if (left == right) return left;
            int mid = (left + right) >> 1;
            if (l > mid) return getFirst(getRight(X), getRight(Y), x, V, mid + 1, right, l);
            int u = getFirst(getLeft(X), getLeft(Y), x, V, left, mid, l);
            if (u != Integer.MAX_VALUE) return u;
            return getFirst(getRight(X), getRight(Y), x, V, mid + 1, right, mid + 1);
        }

        public void solve(int testNumber, InputReader in, OutputWriter out) {
            int n = in.nextInt(), q = in.nextInt();
            int[] a = in.readIntArray(n);
            Random R = new Random(System.currentTimeMillis());
            long[] vals = new long[n + 1];
            for (int i = 1; i <= n; i++) vals[i] = R.nextLong();
            List<Integer>[] tree = Stream.generate(ArrayList::new).limit(n).toArray(List[]::new);
            for (int i = 1; i < n; i++) {
                int u = in.nextInt() - 1, v = in.nextInt() - 1;
                tree[u].add(v);
                tree[v].add(u);
            }
            DOddMineralResource.Node[] nodes = new DOddMineralResource.Node[n];
            nodes[0] = update(a[0], vals[a[0]], null, 1, n);
            make(nodes, a, vals, 0, -1, tree);
            LcaSchieberVishkin lca = new LcaSchieberVishkin(tree, 0);
            for (int i = 0; i < q; i++) {
                int u = in.nextInt() - 1, v = in.nextInt() - 1, l = in.nextInt(), r = in.nextInt();
                int L = lca.lca(u, v);
                int first = getFirst(nodes[u], nodes[v], a[L], vals[a[L]], 1, n, l);
                long X = xor(l, r, nodes[u], 1, n) ^ xor(l, r, nodes[v], 1, n);
                if (a[L] >= l && a[L] <= r) X ^= vals[a[L]];
                out.println(first <= r ? first : -1);
            }
        }

        public static class Node {
            DOddMineralResource.Node left;
            DOddMineralResource.Node right;
            long xor;

            Node(long value) {
                xor = value;
            }

            Node(DOddMineralResource.Node left, DOddMineralResource.Node right) {
                this.left = left;
                this.right = right;
                xor = 0L;
                if (left != null)
                    xor ^= left.xor;
                if (right != null)
                    xor += right.xor;
            }

        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int[] readIntArray(int size) {
            int[] array = new int[size];
            for (int i = 0; i < size; i++) {
                array[i] = readInt();
            }
            return array;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public int nextInt() {
            int c = read();
            while (isSpaceChar(c)) c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public int readInt() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }

    static class LcaSchieberVishkin {
        int[] parent;
        int[] preOrder;
        int[] I;
        int[] head;
        int[] A;
        int time;

        void dfs1(List<Integer>[] tree, int u, int p) {
            parent[u] = p;
            I[u] = preOrder[u] = time++;
            for (int v : tree[u]) {
                if (v == p)
                    continue;
                dfs1(tree, v, u);
                if (Integer.lowestOneBit(I[u]) < Integer.lowestOneBit(I[v])) {
                    I[u] = I[v];
                }
            }
            head[I[u]] = u;
        }

        void dfs2(List<Integer>[] tree, int u, int p, int up) {
            A[u] = up | Integer.lowestOneBit(I[u]);
            for (int v : tree[u]) {
                if (v == p)
                    continue;
                dfs2(tree, v, u, A[u]);
            }
        }

        public LcaSchieberVishkin(List<Integer>[] tree, int root) {
            int n = tree.length;
            preOrder = new int[n];
            I = new int[n];
            head = new int[n];
            A = new int[n];
            parent = new int[n];

            dfs1(tree, root, -1);
            dfs2(tree, root, -1, 0);
        }

        int enterIntoStrip(int x, int hz) {
            if (Integer.lowestOneBit(I[x]) == hz)
                return x;
            int hw = Integer.highestOneBit(A[x] & (hz - 1));
            return parent[head[I[x] & -hw | hw]];
        }

        public int lca(int x, int y) {
            int hb = I[x] == I[y] ? Integer.lowestOneBit(I[x]) : Integer.highestOneBit(I[x] ^ I[y]);
            int hz = Integer.lowestOneBit(A[x] & A[y] & -hb);
            int ex = enterIntoStrip(x, hz);
            int ey = enterIntoStrip(y, hz);
            return preOrder[ex] < preOrder[ey] ? ex : ey;
        }

    }

    static class OutputWriter {
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void println(Object... objects) {
            for (int i = 0; i < objects.length; i++) {
                if (i != 0) {
                    writer.print(' ');
                }
                writer.print(objects[i]);
            }
            writer.print('\n');
        }

        public void close() {
            writer.close();
        }

    }
}