#define DEBUG 1
#include <bits/stdc++.h>
#define loop(n) for (lint ngtkana_is_a_genius = 0; ngtkana_is_a_genius < lint(n); ngtkana_is_a_genius++)
#define rep(i, begin, end) for (lint i = lint(begin); (i) < lint(end); i++)
#define all(v) v.begin(), v.end()
#define rand(l, r) std::uniform_int_distribution<>(l, r)(mt)
using lint = long long;
auto mt = std::mt19937_64(std::random_device{}());
auto cmn = [](auto&& a, auto b){ if (a > b) {a = b; return true;} return false; };
auto cmx = [](auto&& a, auto b){ if (a < b) {a = b; return true;} return false; };
void debug_impl() { std::cerr << std::endl; }
template <typename Head, typename... Tail>
void debug_impl(Head head, Tail... tail) { std::cerr << " " << head; debug_impl(tail...); }
#if DEBUG
#define debug(...)\
    do {\
        std::cerr << std::boolalpha << "[" << #__VA_ARGS__ << "]:";\
        debug_impl(__VA_ARGS__);\
        std::cerr << std::noboolalpha;\
    } while (false)
#else
#define debug(...) {}
#endif

template < class Value >
class lowest_common_ancestor {
        struct edge {
            int to; Value cost;
            edge(int to, Value cost) : to(to), cost(cost){}
        };
        int n, lg, powlg;

    public:
        std::vector< std::vector< edge > > graph;
        std::vector< int > depth;
        std::vector< Value > w_depth;
        std::vector< std::vector< int > >table;
        std::vector< int > &tail;
        using cost_type = Value;
        lowest_common_ancestor(int n) :
            n(n),
            lg(std::log2(n)),
            powlg(std::pow(2, lg)),
            graph(n),
            depth(n, 0),
            w_depth(n, 0),
            table(lg + 1, std::vector< int >(n)),
            tail(table.back())
            {}

        void insert (int u, int v, Value cost = 1) {
            graph.at(u).emplace_back(v, cost);
            graph.at(v).emplace_back(u, cost);
        }

        void build (int root = 0) {
            auto dfs = [&](auto f, int crr, int p) -> void {
                tail.at(crr) = p;
                for (auto const& e : graph.at(crr)) {
                    if (e.to == p) continue;
                    depth.at(e.to) = depth.at(crr) + 1;
                    w_depth.at(e.to) = w_depth.at(crr) + e.cost;
                    f(f, e.to, crr);
                }
            };
            dfs(dfs, root, root);
            for (int p = lg; p >= 1; p--) {
                auto & crr = table.at(p);
                auto & nxt = table.at(p - 1);
                for (int i = 0; i < n; i++) {
                    nxt.at(i) = crr.at(crr.at(i));
                }
            }
        }

        auto query(int u, int v) const -> int {
            if (depth.at(u) < depth.at(v)) std::swap(u, v);
            auto diff = depth.at(u) - depth.at(v);
            if (diff > 0) {
                int coeff = powlg;
                for (auto const & row : table) {
                    if (coeff < diff) {
                        u = row.at(u);
                        diff -= coeff;
                    }
                    coeff /= 2;
                }
                u = tail.at(u);
                diff--;
            }
            assert(diff == 0);
            assert(depth.at(u) == depth.at(v));
            if (u == v) return u;
            for (auto const & row : table) {
                auto next_u = row.at(u);
                auto next_v = row.at(v);
                if (next_u != next_v) {
                    u = next_u;
                    v = next_v;
                }
            }
            assert(u != v);
            u = tail.at(u), v = tail.at(v), assert(u == v);
            return u;
        }

        auto row_distance (int u, int v) const -> int {
            return depth.at(u) + depth.at(v) - 2 * depth.at(query(u, v));
        }

        auto weighted_distance (int u, int v) const -> Value {
            return w_depth.at(u) + w_depth.at(v) - 2 * w_depth.at(query(u, v));
        }
};

int main() {
    std::cin.tie(0); std::cin.sync_with_stdio(false);
    int n; std::cin >> n;
    lowest_common_ancestor<int>lca(n);
    loop(n-1){
        int u, v; std::cin >> u >> v;
        lca.insert(u-1,v-1);
    }
    lca.build();
    int q; std::cin >> q;
    loop(q){
        int x, y, a, b, k;
        std::cin >> x >> y >> a >> b >> k;
        x--,y--,a--,b--;
        int q_xy=lca.query(x,y);
        auto dash = [&] (int u) {
            int ux=lca.query(u,x);
            int uy=lca.query(u,y);
            if(x==ux&&lca.query(y,ux)!=ux)return x;
            if(y==uy&&lca.query(x,uy)!=uy)return y;
            int u_=lca.depth.at(ux)<lca.depth.at(uy)?uy:ux;
            return lca.query(u_,q_xy)==q_xy?u_:q_xy;
        };
        auto bonus = [&] {
            int D=lca.row_distance(x,y)+1;
            if(D%2==0)return -1;
            int a_=dash(a),b_=dash(b);
            if(a_!=b_)return D-2*lca.row_distance(a_,b_);
            if(lca.query(a_,q_xy)==q_xy)return D+2*lca.row_distance(lca.query(a,b),a_);
            int q_xya=lca.query(q_xy,a),q_xyb=lca.query(q_xy,b);
            int c=lca.depth.at(q_xya)<lca.depth.at(q_xyb)?q_xyb:q_xya;
            return D+2*lca.row_distance(c,q_xya);
        }();
        int d=std::min({
            lca.row_distance(a,b),
            lca.row_distance(a,x)+1+lca.row_distance(y,b),
            lca.row_distance(a,y)+1+lca.row_distance(x,b)
        });
        std::cout << (d<=k&&((bonus!=-1&&d+bonus<=k)||(k-d)%2==0)?"YES":"NO") << std::endl;
    }
    return 0;
}

/*
LCA などで、2頂点距離クエリに答えられるようにしておきます。
最短距離は、
- d(a,b)
- d(a,x)+1+d(y,b)
- d(a,y)+1+d(x,b)
の最小です。
偶奇は基本的にあっていて欲しいです。

距離の偶数なものを結ぶと奇数長 (=D)サイクルができて、ボーナスタイムです。
なもりでおなじ枝かどうかを確認です。
なもりサイクルに引いてきた点を a', b' としましょう。
これは、x, y との LCA のうち深いほうです。

a'!=b'のとき、別の枝です。
ボーナスは、D - 2*d(a',b') 以上の余裕が必要です。

a'==b'のとき、おなじ枝です。
ボーナスは、c=LCA(a,b) として、D + 2*d(c',c) 以上の余裕が必要です。
*/


// E.cpp
#include <bits/stdc++.h>

using namespace std;

const int MAX_N = 1e5 + 200;

int head[MAX_N], current, n, q, dep[MAX_N], fa[20][MAX_N];

struct edge
{
    int to, nxt;
} edges[MAX_N << 1];

void addpath(int src, int dst)
{
    edges[current].to = dst, edges[current].nxt = head[src];
    head[src] = current++;
}

void dfs(int u)
{
    dep[u] = dep[fa[0][u]] + 1;
    for (int i = head[u]; i != -1; i = edges[i].nxt)
        if (edges[i].to != fa[0][u])
            fa[0][edges[i].to] = u, dfs(edges[i].to);
}

int getLCA(int x, int y)
{
    if (dep[x] < dep[y])
        swap(x, y);
    for (int i = 19; i >= 0; i--)
        if (dep[fa[i][x]] >= dep[y])
            x = fa[i][x];
    if (x == y)
        return x;
    for (int i = 19; i >= 0; i--)
        if (fa[i][x] != fa[i][y])
            x = fa[i][x], y = fa[i][x];
    return fa[0][x];
}

int getDist(int x, int y) { return dep[x] + dep[y] - (dep[getLCA(x, y)] << 1); }

int main()
{
    memset(head, -1, sizeof(head));
    scanf("%d", &n);
    for (int i = 1, u, v; i <= n - 1; i++)
        scanf("%d%d", &u, &v), addpath(u, v), addpath(v, u);
    dfs(1), scanf("%d", &q);
    for (int i = 1; i <= 19; i++)
        for (int j = 1; j <= n; j++)
            fa[i][j] = fa[i - 1][fa[i - 1][j]];
    while (q--)
    {
        int x, y, a, b, k;
        scanf("%d%d%d%d%d", &x, &y, &a, &b, &k);
        int org = getDist(a, b);
        int loop = min(getDist(a, x) + getDist(b, y), getDist(a, y) + getDist(b, x)) + 1;
        int ans = 2e9;
        if ((loop % 2) == (k % 2))
            ans = min(ans, loop);
        if ((org % 2) == (k % 2))
            ans = min(ans, org);
        puts(ans <= k ? "YES" : "NO");
    }
    return 0;
}


// E.cpp
#include <bits/stdc++.h>

using namespace std;

const int MAX_N = 1e5 + 200;

int head[MAX_N], current, n, q, dep[MAX_N], fa[20][MAX_N];

struct edge
{
    int to, nxt;
} edges[MAX_N << 1];

void addpath(int src, int dst)
{
    edges[current].to = dst, edges[current].nxt = head[src];
    head[src] = current++;
}

void dfs(int u)
{
    dep[u] = dep[fa[0][u]] + 1;
    for (int i = head[u]; i != -1; i = edges[i].nxt)
        if (edges[i].to != fa[0][u])
            fa[0][edges[i].to] = u, dfs(edges[i].to);
}

int getLCA(int x, int y)
{
    if (dep[x] < dep[y])
        swap(x, y);
    for (int i = 19; i >= 0; i--)
        if (dep[fa[i][x]] >= dep[y])
            x = fa[i][x];
    if (x == y)
        return x;
    for (int i = 19; i >= 0; i--)
        if (fa[i][x] != fa[i][y])
            x = fa[i][x], y = fa[i][y];
    return fa[0][x];
}

int getDist(int x, int y) { return dep[x] + dep[y] - (dep[getLCA(x, y)] << 1); }

int main()
{
    memset(head, -1, sizeof(head));
    scanf("%d", &n);
    for (int i = 1, u, v; i <= n - 1; i++)
        scanf("%d%d", &u, &v), addpath(u, v), addpath(v, u);
    dfs(1), scanf("%d", &q);
    for (int i = 1; i <= 19; i++)
        for (int j = 1; j <= n; j++)
            fa[i][j] = fa[i - 1][fa[i - 1][j]];
    while (q--)
    {
        int x, y, a, b, k;
        scanf("%d%d%d%d%d", &x, &y, &a, &b, &k);
        int org = getDist(a, b);
        int loop = min(getDist(a, x) + getDist(y, b), getDist(a, y) + getDist(x, b)) + 1;
        int loop_1 = getDist(x, y) + getDist(a, x) + getDist(b, x) + 1;
        int loop_2 = getDist(x, y) + getDist(a, y) + getDist(b, y) + 1;
        int ans = 2e9;
        if ((org % 2) == (k % 2))
            ans = org;
        if ((loop % 2) == (k % 2))
            ans = min(ans, loop);
        if ((loop_1 % 2) == (k % 2))
            ans = min(ans, loop_1);
        if ((loop_2 % 2) == (k % 2))
            ans = min(ans, loop_2);
        puts(ans <= k ? "YES" : "NO");
    }
    return 0;
}


// E.cpp
#include <bits/stdc++.h>

using namespace std;

const int MAX_N = 1e5 + 200;

int head[MAX_N], current, n, q, dep[MAX_N], fa[20][MAX_N];

struct edge
{
    int to, nxt;
} edges[MAX_N << 1];

void addpath(int src, int dst)
{
    edges[current].to = dst, edges[current].nxt = head[src];
    head[src] = current++;
}

void dfs(int u)
{
    dep[u] = dep[fa[0][u]] + 1;
    for (int i = head[u]; i != -1; i = edges[i].nxt)
        if (edges[i].to != fa[0][u])
            fa[0][edges[i].to] = u, dfs(edges[i].to);
}

int getLCA(int x, int y)
{
    if (dep[x] < dep[y])
        swap(x, y);
    for (int i = 19; i >= 0; i--)
        if (dep[fa[i][x]] >= dep[y])
            x = fa[i][x];
    if (x == y)
        return x;
    for (int i = 19; i >= 0; i--)
        if (fa[i][x] != fa[i][y])
            x = fa[i][x], y = fa[i][x];
    return fa[0][x];
}

int getDist(int x, int y) { return dep[x] + dep[y] - (dep[getLCA(x, y)] << 1); }

int main()
{
    memset(head, -1, sizeof(head));
    scanf("%d", &n);
    for (int i = 1, u, v; i <= n - 1; i++)
        scanf("%d%d", &u, &v), addpath(u, v), addpath(v, u);
    dfs(1), scanf("%d", &q);
    for (int i = 1; i <= 19; i++)
        for (int j = 1; j <= n; j++)
            fa[i][j] = fa[i - 1][fa[i - 1][j]];
    while (q--)
    {
        int x, y, a, b, k;
        scanf("%d%d%d%d%d", &x, &y, &a, &b, &k);
        int org = getDist(a, b);
        int loop = min(getDist(a, x) + getDist(b, y), getDist(a, y) + getDist(b, x)) + 1;
        int ans = 2e9;
        if ((loop & 1) == (k & 1))
            ans = min(ans, loop);
        if ((org & 1) == (k & 1))
            ans = min(ans, org);
        puts(ans <= k ? "YES" : "NO");
    }
    return 0;
}


// E.cpp
#include <bits/stdc++.h>

using namespace std;

const int MAX_N = 1e5 + 200;

int head[MAX_N], current, n, q, dep[MAX_N], fa[20][MAX_N];

struct edge
{
    int to, nxt;
} edges[MAX_N << 1];

void addpath(int src, int dst)
{
    edges[current].to = dst, edges[current].nxt = head[src];
    head[src] = current++;
}

void dfs(int u)
{
    dep[u] = dep[fa[0][u]] + 1;
    for (int i = head[u]; i != -1; i = edges[i].nxt)
        if (edges[i].to != fa[0][u])
            fa[0][edges[i].to] = u, dfs(edges[i].to);
}

int getLCA(int x, int y)
{
    if (dep[x] < dep[y])
        swap(x, y);
    for (int i = 19; i >= 0; i--)
        if (dep[fa[i][x]] >= dep[y])
            x = fa[i][x];
    if (x == y)
        return x;
    for (int i = 19; i >= 0; i--)
        if (fa[i][x] != fa[i][y])
            x = fa[i][x], y = fa[i][y];
    return fa[0][x];
}

int getDist(int x, int y) { return dep[x] + dep[y] - (dep[getLCA(x, y)] << 1); }

int main()
{
    memset(head, -1, sizeof(head));
    scanf("%d", &n);
    for (int i = 1, u, v; i <= n - 1; i++)
        scanf("%d%d", &u, &v), addpath(u, v), addpath(v, u);
    dfs(1), scanf("%d", &q);
    for (int i = 1; i <= 19; i++)
        for (int j = 1; j <= n; j++)
            fa[i][j] = fa[i - 1][fa[i - 1][j]];
    while (q--)
    {
        int x, y, a, b, k;
        scanf("%d%d%d%d%d", &x, &y, &a, &b, &k);
        int org = getDist(a, b);
        int loop = min(getDist(a, x) + getDist(y, b), getDist(a, y) + getDist(x, b)) + 1;
        int loop_1 = org + getDist(a, x) + getDist(b, y) + 1;
        int loop_2 = org + getDist(a, y) + getDist(b, x) + 1;
        int ans = 2e9;
        if ((org % 2) == (k % 2))
            ans = org;
        if ((loop % 2) == (k % 2))
            ans = min(ans, loop);
        if ((loop_1 % 2) == (k % 2))
            ans = min(ans, loop_1);
        if ((loop_2 % 2) == (k % 2))
            ans = min(ans, loop_2);
        puts(ans <= k ? "YES" : "NO");
    }
    return 0;
}


// E.cpp
#include <bits/stdc++.h>

using namespace std;

const int MAX_N = 1e5 + 200;

int head[MAX_N], current, n, q, dep[MAX_N], fa[20][MAX_N];

struct edge
{
    int to, nxt;
} edges[MAX_N << 1];

void addpath(int src, int dst)
{
    edges[current].to = dst, edges[current].nxt = head[src];
    head[src] = current++;
}

void dfs(int u)
{
    dep[u] = dep[fa[0][u]] + 1;
    for (int i = head[u]; i != -1; i = edges[i].nxt)
        if (edges[i].to != fa[0][u])
            fa[0][edges[i].to] = u, dfs(edges[i].to);
}

int getLCA(int x, int y)
{
    if (dep[x] < dep[y])
        swap(x, y);
    for (int i = 19; i >= 0; i--)
        if (dep[fa[i][x]] >= dep[y])
            x = fa[i][x];
    if (x == y)
        return x;
    for (int i = 19; i >= 0; i--)
        if (fa[i][x] != fa[i][y])
            x = fa[i][x], y = fa[i][y];
    return fa[0][x];
}

int getDist(int x, int y) { return dep[x] + dep[y] - (dep[getLCA(x, y)] << 1); }

int main()
{
    memset(head, -1, sizeof(head));
    scanf("%d", &n);
    for (int i = 1, u, v; i <= n - 1; i++)
        scanf("%d%d", &u, &v), addpath(u, v), addpath(v, u);
    dfs(1), scanf("%d", &q);
    for (int i = 1; i <= 19; i++)
        for (int j = 1; j <= n; j++)
            fa[i][j] = fa[i - 1][fa[i - 1][j]];
    while (q--)
    {
        int x, y, a, b, k;
        scanf("%d%d%d%d%d", &x, &y, &a, &b, &k);
        int org = getDist(a, b);
        int loop = min(getDist(a, x) + getDist(y, b), getDist(a, y) + getDist(x, b)) + 1;
        int loop_1 = getDist(x, y) + getDist(a, x) + getDist(b, y) + 1;
        int loop_2 = getDist(x, y) + getDist(a, y) + getDist(b, x) + 1;
        int ans = 2e9;
        if ((org % 2) == (k % 2))
            ans = org;
        if ((loop % 2) == (k % 2))
            ans = min(ans, loop);
        if ((loop_1 % 2) == (k % 2))
            ans = min(ans, loop_1);
        if ((loop_2 % 2) == (k % 2))
            ans = min(ans, loop_2);
        puts(ans <= k ? "YES" : "NO");
    }
    return 0;
}


// E.cpp
#include <bits/stdc++.h>

using namespace std;

const int MAX_N = 1e5 + 200;

int head[MAX_N], current, n, q, dep[MAX_N], fa[20][MAX_N];

struct edge
{
    int to, nxt;
} edges[MAX_N << 1];

void addpath(int src, int dst)
{
    edges[current].to = dst, edges[current].nxt = head[src];
    head[src] = current++;
}

void dfs(int u)
{
    dep[u] = dep[fa[0][u]] + 1;
    for (int i = head[u]; i != -1; i = edges[i].nxt)
        if (edges[i].to != fa[0][u])
            fa[0][edges[i].to] = u, dfs(edges[i].to);
}

int getLCA(int x, int y)
{
    if (dep[x] < dep[y])
        swap(x, y);
    for (int i = 19; i >= 0; i--)
        if (dep[fa[i][x]] >= dep[y])
            x = fa[i][x];
    if (x == y)
        return x;
    for (int i = 19; i >= 0; i--)
        if (fa[i][x] != fa[i][y])
            x = fa[i][x], y = fa[i][x];
    return fa[0][x];
}

int getDist(int x, int y) { return dep[x] + dep[y] - (dep[getLCA(x, y)] << 1); }

int main()
{
    memset(head, -1, sizeof(head));
    scanf("%d", &n);
    for (int i = 1, u, v; i <= n - 1; i++)
        scanf("%d%d", &u, &v), addpath(u, v), addpath(v, u);
    dfs(1), scanf("%d", &q);
    for (int i = 1; i <= 19; i++)
        for (int j = 1; j <= n; j++)
            fa[i][j] = fa[i - 1][fa[i - 1][j]];
    while (q--)
    {
        int x, y, a, b, k;
        scanf("%d%d%d%d%d", &x, &y, &a, &b, &k);
        int org = getDist(a, b);
        int loop = min(getDist(a, x) + getDist(y, b), getDist(a, y) + getDist(x, b)) + 1;
        int ans = 2e9;
        if ((org % 2) == (k % 2))
            ans = org;
        if ((loop % 2) == (k % 2))
            ans = min(ans, loop);
        puts(ans <= k ? "YES" : "NO");
    }
    return 0;
}


// E.cpp
#include <bits/stdc++.h>

using namespace std;

const int MAX_N = 1e5 + 200;

int head[MAX_N], current, n, q, dep[MAX_N], fa[20][MAX_N];

struct edge
{
    int to, nxt;
} edges[MAX_N << 1];

void addpath(int src, int dst)
{
    edges[current].to = dst, edges[current].nxt = head[src];
    head[src] = current++;
}

void dfs(int u)
{
    dep[u] = dep[fa[0][u]] + 1;
    for (int i = head[u]; i != -1; i = edges[i].nxt)
        if (edges[i].to != fa[0][u])
            fa[0][edges[i].to] = u, dfs(edges[i].to);
}

int getLCA(int x, int y)
{
    if (dep[x] < dep[y])
        swap(x, y);
    for (int i = 19; i >= 0; i--)
        if (dep[fa[i][x]] >= dep[y])
            x = fa[i][x];
    if (x == y)
        return x;
    for (int i = 19; i >= 0; i--)
        if (fa[i][x] != fa[i][y])
            x = fa[i][x], y = fa[i][x];
    return fa[0][x];
}

int getDist(int x, int y) { return dep[x] + dep[y] - (dep[getLCA(x, y)] << 1); }

int main()
{
    memset(head, -1, sizeof(head));
    scanf("%d", &n);
    for (int i = 1, u, v; i <= n - 1; i++)
        scanf("%d%d", &u, &v), addpath(u, v), addpath(v, u);
    dfs(1), scanf("%d", &q);
    for (int i = 1; i <= 19; i++)
        for (int j = 1; j <= n; j++)
            fa[i][j] = fa[i - 1][fa[i - 1][j]];
    while (q--)
    {
        int x, y, a, b, k;
        scanf("%d%d%d%d%d", &x, &y, &a, &b, &k);
        int org = getDist(a, b);
        int loop = min(getDist(a, x) + getDist(b, y), getDist(a, y) + getDist(b, x)) + 1;
        int ans = 1e9;
        if ((loop & 1) == (k & 1))
            ans = min(ans, loop);
        if ((org & 1) == (k & 1))
            ans = min(ans, org);
        puts(ans <= k ? "YES" : "NO");
    }
    return 0;
}


#include  <map>
#include  <set>
#include  <cmath>
#include  <queue>
#include  <cstdio>
#include  <vector>
#include  <climits>
#include  <cstring>
#include  <cstdlib>
#include  <iostream>
#include  <algorithm>
#define mem(a) memset(a,0,sizeof(a))
#define mem1(a) memset(a,-1,sizeof(a))
#define forn(i,n) for(int i=0;i<n;++i)
#define for1(i,n) for(int i=1;i<=n;++i)
#define IO std::ios::sync_with_stdio(false); std::cin.tie(0)
#define ll long long
#define LL long long
#define inf 0x3f3f3f3f
#define INF 0x3f3f3f3f3f3f3f3f
#define N 1000000
using namespace std;
const int maxn=1e5+50;
//ll gcd(ll a, ll b){return b ? gcd(b, a % b) : a;}
//ll lcm(ll a, ll b){return a * b / gcd(a, b);}

int cnt,ans,disx,n,m;
int a,b,x,y,k;
int head[maxn];
int fa[maxn];
int son[maxn];
int f[maxn];
int res[maxn];
bool vis[maxn];

struct edge
{
    int to,nxt;
};
edge e[maxn<<1];

void add(int a,int b)
{
    e[cnt].to=b;
    e[cnt].nxt=head[a];
    head[a]=cnt++;
}

bool flag=false;
void dfs(int cur,int tar,int step)
{
    vis[cur]=1;
    if(cur==tar)
    {
        flag=true;
        ans=step;
//        cout<<"step:"<<step<<endl;
        return;
    }
//    cout<<"head[cur]"<<head[cur]<<endl;
    for(int i=head[cur]; ~i; i=e[i].nxt)
    {
        int u=e[i].to;
//        cout<<"u:"<<u<<endl;
        if(!vis[u])
        {
            dfs(u,tar,step+1);
        }
    }
}

int main()
{
    mem1(head);
    cin>>n;
    for(int i=1; i<n; ++i)
    {
        int u,v;
        scanf("%d %d",&u,&v);
        add(u,v);
        add(v,u);
    }
    cin>>m;
    for(int i=1; i<=m; ++i)
    {
        scanf("%d %d %d %d %d",&x,&y,&a,&b,&k);
        ans=0;
        flag=false;
        mem(vis);
        dfs(a,b,0);
//        cout<<"a:"<<a<<" b:"<<b<<endl;
//        cout<<"a-b:"<<ans<<endl;
        if(ans<=k&&abs(ans-k)%2==0)
        {
            printf("YES\n");
            continue;
        }
        ans=0;
        mem(vis);
        dfs(a,x,0);
        int disax=ans;
//        cout<<"a-x:"<<disax<<endl;
        ans=0;
        mem(vis);
        dfs(b,y,0);
        int disby=ans;
        ans=0;
        mem(vis);
        dfs(x,y,0);
        int disxy=ans;
//        cout<<"b-y:"<<disby<<endl;
        int tot1=disax+disby+1;
        int tot12=disax+disby+disxy;
        if(tot1<=k&&abs(tot1-k)%2==0||tot12<=k&&abs(tot12-k)%2==0)
        {
            printf("YES\n");
            continue;
        }
        ans=0;
        mem(vis);
        dfs(a,y,0);
        int disay=ans;
//        cout<<"a-y:"<<disay<<endl;
        ans=0;
        mem(vis);
        dfs(b,x,0);
        int disbx=ans;
//        cout<<"b-x:"<<disbx<<endl;
        int tot2=disay+disbx+1;
        int tot22=disay+disbx+disxy;
        if(tot2<=k&&abs(tot2-k)%2==0||tot22<=k&&abs(tot22-k)%2==0)
        {
            printf("YES\n");
            continue;
        }
        printf("NO\n");
    }

    return 0;
}


#include  <map>
#include  <set>
#include  <cmath>
#include  <queue>
#include  <cstdio>
#include  <vector>
#include  <climits>
#include  <cstring>
#include  <cstdlib>
#include  <iostream>
#include  <algorithm>
#define mem(a) memset(a,0,sizeof(a))
#define mem1(a) memset(a,-1,sizeof(a))
#define forn(i,n) for(int i=0;i<n;++i)
#define for1(i,n) for(int i=1;i<=n;++i)
#define IO std::ios::sync_with_stdio(false); std::cin.tie(0)
#define ll long long
#define LL long long
#define inf 0x3f3f3f3f
#define INF 0x3f3f3f3f3f3f3f3f
#define N 1000000
using namespace std;
const int maxn=1e5+50;
//ll gcd(ll a, ll b){return b ? gcd(b, a % b) : a;}
//ll lcm(ll a, ll b){return a * b / gcd(a, b);}

int cnt,ans,disx,n,m;
int a,b,x,y,k;
int head[maxn];
int fa[maxn][22];
int lg[maxn];
int depth[maxn];
int res[maxn];
bool vis[maxn];

struct edge
{
    int t,nex;
};
edge e[maxn<<1];

void add(int a,int b)
{
    e[++cnt].t=b;
    e[cnt].nex=head[a];
    head[a]=cnt;
}

void dfs(int f,int fath)
{
    depth[f]=depth[fath]+1;
    fa[f][0]=fath;//注意fa[f][0]记录的是直接祖先
    for(int i=1;(1<<i)<=depth[f];i++)
      fa[f][i]=fa[fa[f][i-1]][i-1];//这个转移可以说是算法的核心之一
    //意思是f的2^i祖先等于f的2^(i-1)祖先的2^(i-1)祖先
    //2^i=2^(i-1)+2^(i-1)
    for(int i=head[f];i;i=e[i].nex)//链式前向星的遍历
      if(e[i].t!=fath)
        dfs(e[i].t,f);
}
int lca(int x,int y)
{
    if(depth[x]<depth[y])
      swap(x,y);
    while(depth[x]>depth[y])
      x=fa[x][lg[depth[x]-depth[y]]-1];//先跳到同一高度
    if(x==y)
      return x;
    for(int k=lg[depth[x]]-1;k>=0;k--)//一起从上往下找
      if(fa[x][k]!=fa[y][k])
        x=fa[x][k], y=fa[y][k];
    return fa[x][0];
}

int cal(int x,int y)
{
    return depth[x]+depth[y]-2*depth[lca(x,y)];
}

int main()
{
    cin>>n;
    for(int i=1; i<n; ++i)
    {
        int u,v;
        scanf("%d %d",&u,&v);
        add(u,v);
        add(v,u);
    }
    dfs(1,0);
    for(int i=1;i<=n;i++)
      lg[i]=lg[i-1]+(1<<lg[i-1]==i);
    cin>>m;
    for(int i=1; i<=m; ++i)
    {
        scanf("%d %d %d %d %d",&x,&y,&a,&b,&k);
        int disab=cal(a,b);
//        cout<<disab<<endl;
        if(disab<=k&&abs(disab-k)%2==0)
        {
            printf("YES\n");
            continue;
        }
        int disax=cal(a,x);
        int disby=cal(b,y);
        int tot1=disax+disby+1;
        if(tot1<=k&&abs(tot1-k)%2==0)
        {
            printf("YES\n");
            continue;
        }
        int disay=cal(a,y);
        int disbx=cal(b,x);
        int tot2=disay+disbx+1;
        if(tot2<=k&&abs(tot2-k)%2==0)
        {
            printf("YES\n");
            continue;
        }
        printf("NO\n");
    }

    return 0;
}


#include  <map>
#include  <set>
#include  <cmath>
#include  <queue>
#include  <cstdio>
#include  <vector>
#include  <climits>
#include  <cstring>
#include  <cstdlib>
#include  <iostream>
#include  <algorithm>
#define mem(a) memset(a,0,sizeof(a))
#define mem1(a) memset(a,-1,sizeof(a))
#define forn(i,n) for(int i=0;i<n;++i)
#define for1(i,n) for(int i=1;i<=n;++i)
#define IO std::ios::sync_with_stdio(false); std::cin.tie(0)
#define ll long long
#define LL long long
#define inf 0x3f3f3f3f
#define INF 0x3f3f3f3f3f3f3f3f
#define N 1000000
using namespace std;
const int maxn=3e5+50;
//ll gcd(ll a, ll b){return b ? gcd(b, a % b) : a;}
//ll lcm(ll a, ll b){return a * b / gcd(a, b);}

int cnt,ans,disx,n,m;
int a,b,x,y,k;
int head[maxn];
int fa[maxn];
int son[maxn];
int f[maxn];
int res[maxn];
bool vis[maxn];

struct edge
{
    int to,nxt;
};
edge e[maxn<<1];

void add(int a,int b)
{
    e[cnt].to=b;
    e[cnt].nxt=head[a];
    head[a]=cnt++;
}

bool flag=false;
void dfs(int cur,int tar,int step)
{
    vis[cur]=1;
    if(cur==tar)
    {
        flag=true;
        ans=step;
//        cout<<"step:"<<step<<endl;
        return;
    }
//    cout<<"head[cur]"<<head[cur]<<endl;
    for(int i=head[cur]; ~i; i=e[i].nxt)
    {
        int u=e[i].to;
//        cout<<"u:"<<u<<endl;
        if(!vis[u])
        {
            dfs(u,tar,step+1);
        }
    }
}

int main()
{
    mem1(head);
    cin>>n;
    for(int i=1; i<n; ++i)
    {
        int u,v;
        scanf("%d %d",&u,&v);
        add(u,v);
        add(v,u);
    }
    cin>>m;
    for(int i=1; i<=m; ++i)
    {
        scanf("%d %d %d %d %d",&x,&y,&a,&b,&k);
        ans=0;
        flag=false;
        mem(vis);
        dfs(a,b,0);
//        cout<<"a:"<<a<<" b:"<<b<<endl;
//        cout<<"a-b:"<<ans<<endl;
        if(ans<=k&&abs(ans-k)%2==0)
        {
            printf("YES\n");
            continue;
        }
        ans=0;
        mem(vis);
        dfs(a,x,0);
        int disax=ans;
//        cout<<"a-x:"<<disax<<endl;
        ans=0;
        mem(vis);
        dfs(b,y,0);
        int disby=ans;
//        cout<<"b-y:"<<disby<<endl;
        int tot1=disax+disby+1;
        if(tot1<=k&&abs(tot1-k)%2==0)
        {
            printf("YES\n");
            continue;
        }
        ans=0;
        mem(vis);
        dfs(a,y,0);
        int disay=ans;
//        cout<<"a-y:"<<disay<<endl;
        ans=0;
        mem(vis);
        dfs(b,x,0);
        int disbx=ans;
//        cout<<"b-x:"<<disbx<<endl;
        int tot2=disay+disbx+1;
        if(tot2<=k&&abs(tot2-k)%2==0)
        {
            printf("YES\n");
            continue;
        }
        printf("NO\n");
    }

    return 0;
}


#include  <map>
#include  <set>
#include  <cmath>
#include  <queue>
#include  <cstdio>
#include  <vector>
#include  <climits>
#include  <cstring>
#include  <cstdlib>
#include  <iostream>
#include  <algorithm>
#define mem(a) memset(a,0,sizeof(a))
#define mem1(a) memset(a,-1,sizeof(a))
#define forn(i,n) for(int i=0;i<n;++i)
#define for1(i,n) for(int i=1;i<=n;++i)
#define IO std::ios::sync_with_stdio(false); std::cin.tie(0)
#define ll long long
#define LL long long
#define inf 0x3f3f3f3f
#define INF 0x3f3f3f3f3f3f3f3f
#define N 1000000
using namespace std;
const int maxn=1e5+50;
//ll gcd(ll a, ll b){return b ? gcd(b, a % b) : a;}
//ll lcm(ll a, ll b){return a * b / gcd(a, b);}

int cnt,ans,disx,n,m;
int a,b,x,y,k;
int head[maxn];
int fa[maxn];
int son[maxn];
int depth[maxn];
int res[maxn];
bool vis[maxn];

struct edge
{
    int to,nxt;
};
edge e[maxn<<1];

void add(int a,int b)
{
    e[cnt].to=b;
    e[cnt].nxt=head[a];
    head[a]=cnt++;
}

void predeal(int cur,int dep)
{
    vis[cur]=1;
    depth[cur]=dep;
    for(int i=head[cur];~i;i=e[i].nxt)
    {
        int u=e[i].to;
        if(!vis[u])
        {
            fa[u]=cur;
            predeal(u,dep+1);
        }
    }
}

int lca(int x,int y)
{
    if(depth[x]>depth[y])
        swap(x,y);
    while(depth[y]!=depth[x])
    {
        y=fa[y];
    }
    while(fa[x]!=fa[y])
    {
        x=fa[x];
        y=fa[y];
    }
    return x;
}

int cal(int x,int y)
{
    return depth[x]+depth[y]-2*depth[lca(x,y)];
}

int main()
{
    mem1(head);
    cin>>n;
    for(int i=1; i<n; ++i)
    {
        int u,v;
        scanf("%d %d",&u,&v);
        add(u,v);
        add(v,u);
    }
    fa[1]=1;
    predeal(1,1);
    cin>>m;
    for(int i=1; i<=m; ++i)
    {
        scanf("%d %d %d %d %d",&x,&y,&a,&b,&k);
        int disab=cal(a,b);
//        cout<<disab<<endl;
        if(disab<=k&&abs(disab-k)%2==0)
        {
            printf("YES\n");
            continue;
        }
        int disax=cal(a,x);
        int disby=cal(b,y);
        int tot1=disax+disby+1;
        if(tot1<=k&&abs(tot1-k)%2==0)
        {
            printf("YES\n");
            continue;
        }
        int disay=cal(a,y);
        int disbx=cal(b,x);
        int tot2=disay+disbx+1;
        if(tot2<=k&&abs(tot2-k)%2==0)
        {
            printf("YES\n");
            continue;
        }
        printf("NO\n");
    }

    return 0;
}


#include  <map>
#include  <set>
#include  <cmath>
#include  <queue>
#include  <cstdio>
#include  <vector>
#include  <climits>
#include  <cstring>
#include  <cstdlib>
#include  <iostream>
#include  <algorithm>
#define mem(a) memset(a,0,sizeof(a))
#define mem1(a) memset(a,-1,sizeof(a))
#define forn(i,n) for(int i=0;i<n;++i)
#define for1(i,n) for(int i=1;i<=n;++i)
#define IO std::ios::sync_with_stdio(false); std::cin.tie(0)
#define ll long long
#define LL long long
#define inf 0x3f3f3f3f
#define INF 0x3f3f3f3f3f3f3f3f
#define N 1000000
using namespace std;
const int maxn=1e5+50;
//ll gcd(ll a, ll b){return b ? gcd(b, a % b) : a;}
//ll lcm(ll a, ll b){return a * b / gcd(a, b);}

int cnt,ans,disx,n,m;
int a,b,x,y,k;
int head[maxn];
int fa[maxn];
int son[maxn];
int depth[maxn];
int res[maxn];
bool vis[maxn];

struct edge
{
    int to,nxt;
};
edge e[maxn<<1];

void add(int a,int b)
{
    e[cnt].to=b;
    e[cnt].nxt=head[a];
    head[a]=cnt++;
}

void predeal(int cur,int dep)
{
    vis[cur]=1;
    depth[cur]=dep;
    for(int i=head[cur];~i;i=e[i].nxt)
    {
        int u=e[i].to;
        if(!vis[u])
        {
            fa[u]=cur;
            predeal(u,dep+1);
        }
    }
}

int lca(int x,int y)
{
    if(depth[x]>depth[y])
        swap(x,y);
    while(depth[y]!=depth[x])
    {
        y=fa[y];
    }
    while(x!=y)
    {
        x=fa[x];
        y=fa[y];
    }
    return x;
}

int cal(int x,int y)
{
    return depth[x]+depth[y]-2*depth[lca(x,y)];
}

int main()
{
    mem1(head);
    cin>>n;
    for(int i=1; i<n; ++i)
    {
        int u,v;
        scanf("%d %d",&u,&v);
        add(u,v);
        add(v,u);
    }
    fa[1]=1;
    predeal(1,1);
    cin>>m;
    for(int i=1; i<=m; ++i)
    {
        scanf("%d %d %d %d %d",&x,&y,&a,&b,&k);
        int disab=cal(a,b);
//        cout<<disab<<endl;
        if(disab<=k&&abs(disab-k)%2==0)
        {
            printf("YES\n");
            continue;
        }
        int disax=cal(a,x);
        int disby=cal(b,y);
        int tot1=disax+disby+1;
        if(tot1<=k&&abs(tot1-k)%2==0)
        {
            printf("YES\n");
            continue;
        }
        int disay=cal(a,y);
        int disbx=cal(b,x);
        int tot2=disay+disbx+1;
        if(tot2<=k&&abs(tot2-k)%2==0)
        {
            printf("YES\n");
            continue;
        }
        printf("NO\n");
    }

    return 0;
}


#include  <map>
#include  <set>
#include  <cmath>
#include  <queue>
#include  <cstdio>
#include  <vector>
#include  <climits>
#include  <cstring>
#include  <cstdlib>
#include  <iostream>
#include  <algorithm>
#define mem(a) memset(a,0,sizeof(a))
#define mem1(a) memset(a,-1,sizeof(a))
#define forn(i,n) for(int i=0;i<n;++i)
#define for1(i,n) for(int i=1;i<=n;++i)
#define IO std::ios::sync_with_stdio(false); std::cin.tie(0)
#define ll long long
#define LL long long
#define inf 0x3f3f3f3f
#define INF 0x3f3f3f3f3f3f3f3f
#define N 1000000
using namespace std;
const int maxn=3e5+50;
//ll gcd(ll a, ll b){return b ? gcd(b, a % b) : a;}
//ll lcm(ll a, ll b){return a * b / gcd(a, b);}

int cnt,ans,disx,n,m;
int a,b,x,y,k;
int head[maxn];
int fa[maxn];
int son[maxn];
int f[maxn];
int res[maxn];
bool vis[maxn];

struct edge
{
    int to,nxt;
};
edge e[maxn<<1];

void add(int a,int b)
{
    e[cnt].to=b;
    e[cnt].nxt=head[a];
    head[a]=cnt++;
}

bool flag=false;
void dfs(int cur,int tar,int step)
{
    vis[cur]=1;
    if(cur==tar)
    {
        flag=true;
        ans=step;
//        cout<<"step:"<<step<<endl;
        return;
    }
//    cout<<"head[cur]"<<head[cur]<<endl;
    for(int i=head[cur]; ~i; i=e[i].nxt)
    {
        int u=e[i].to;
//        cout<<"u:"<<u<<endl;
        if(!vis[u])
        {
            dfs(u,tar,step+1);
        }
    }
}

int main()
{
    mem1(head);
    cin>>n;
    for(int i=1; i<n; ++i)
    {
        int u,v;
        scanf("%d %d",&u,&v);
        add(u,v);
        add(v,u);
    }
    cin>>m;
    for(int i=1; i<=m; ++i)
    {
        scanf("%d %d %d %d %d",&x,&y,&a,&b,&k);
        ans=0;
        flag=false;
        mem(vis);
        dfs(a,b,0);
//        cout<<"a:"<<a<<" b:"<<b<<endl;
//        cout<<"a-b:"<<ans<<endl;
        if(ans<=k&&abs(ans-k)%2==0)
        {
            printf("YES\n");
            continue;
        }
        ans=0;
        mem(vis);
        dfs(a,x,0);
        int disax=ans;
//        cout<<"a-x:"<<disax<<endl;
        ans=0;
        mem(vis);
        dfs(b,y,0);
        int disby=ans;
        ans=0;
        mem(vis);
        dfs(x,y,0);
        int disxy=ans;
//        cout<<"b-y:"<<disby<<endl;
        int tot1=disax+disby+1;
        int tot12=disax+disby+disxy;
        if(tot1<=k&&abs(tot1-k)%2==0||tot12<=k&&abs(tot12-k)%2==0)
        {
            printf("YES\n");
            continue;
        }
        ans=0;
        mem(vis);
        dfs(a,y,0);
        int disay=ans;
//        cout<<"a-y:"<<disay<<endl;
        ans=0;
        mem(vis);
        dfs(b,x,0);
        int disbx=ans;
//        cout<<"b-x:"<<disbx<<endl;
        int tot2=disay+disbx+1;
        int tot22=disay+disbx+disxy;
        if(tot2<=k&&abs(tot2-k)%2==0||tot22<=k&&abs(tot22-k)%2==0)
        {
            printf("YES\n");
            continue;
        }
        printf("NO\n");
    }

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

const int N = 1e5+5;

int n;
int q;
vector < int > adj[N];
int bl[N][20] , depth[N];

void dfs(int u , int p){

     bl[u][0] = p;
     depth[u] = depth[p] + 1;

     int h = 1;
     while( (1 << h) <= depth[p] ){
        bl[u][h] = bl[ bl[u][h-1] ][h-1];
        h++;
     }

     for(auto v : adj[u]){
         if(v == p)
            continue;
         dfs(v , u);
     }
}

int getPBL(int u , int p){
    for(int i = 0; (1 << i) <= p; i++){
        if(p & (1 << i)){
            u = bl[u][i];
        }
    }
    return u;
}

int LCA(int u , int v){
    if(depth[u] < depth[v])
        swap(u , v);
    int must = depth[u] - depth[v];
    u = getPBL(u , must);
    if(u == v)
        return u;
    for(int i = 18; ~i; i--){
        if(bl[u][i] != bl[v][i]){
            u = bl[u][i];
            v = bl[v][i];
        }
    }
    return bl[u][0];
}

int dist_f_t(int a , int b){
    int lca = LCA(a , b);
    int dist = depth[a] + depth[b] - 2 * depth[lca];
    return dist;
}

int main(){
    scanf("%d" , &n);
    for(int i = 1; i < n; i++){
        int u , v;
        scanf("%d%d" , &u , &v);
        adj[u].push_back(v);
        adj[v].push_back(u);
    }
    dfs(1 , 0);
    scanf("%d" , &q);
    while(q--){
        int a , b , x , y , k;
        scanf("%d%d%d%d%d" , &x , &y , &a , &b , &k);
        bool yes = 0;
        int dist = dist_f_t(a , b);
        if(dist % 2 == k % 2)
            yes |= 1;
        dist = dist_f_t(a , x) + dist_f_t(y , b) + 1;
        dist = min(dist , dist_f_t(a , y) + dist_f_t(x , b) + 1);
        if(dist % 2 == k % 2)
            yes |= 1;
        puts(yes ? "YES" : "NO");
    }
}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

const int N = 1e5+5;

int n;
int q;
vector < int > adj[N];
int bl[N][20] , depth[N];

void dfs(int u , int p){

     bl[u][0] = p;
     depth[u] = depth[p] + 1;

     int h = 1;
     while( (1 << h) <= depth[p] ){
        bl[u][h] = bl[ bl[u][h-1] ][h-1];
        h++;
     }

     for(auto v : adj[u]){
         if(v == p)
            continue;
         dfs(v , u);
     }
}

int getPBL(int u , int p){
    for(int i = 0; (1 << i) <= p; i++){
        if(p & (1 << i)){
            u = bl[u][i];
        }
    }
    return u;
}

int LCA(int u , int v){
    if(depth[u] < depth[v])
        swap(u , v);
    int must = depth[u] - depth[v];
    u = getPBL(u , must);
    if(u == v)
        return u;
    for(int i = 18; ~i; i--){
        if(bl[u][i] != bl[v][i]){
            u = bl[u][i];
            v = bl[v][i];
        }
    }
    return bl[u][0];
}

int dist_f_t(int a , int b){
    int lca = LCA(a , b);
    int dist = depth[a] + depth[b] - 2 * depth[lca];
    return dist;
}

int main(){
    scanf("%d" , &n);
    for(int i = 1; i < n; i++){
        int u , v;
        scanf("%d%d" , &u , &v);
        adj[u].push_back(v);
        adj[v].push_back(u);
    }
    dfs(1 , 0);
    scanf("%d" , &q);
    while(q--){
        int a , b , x , y , k;
        scanf("%d%d%d%d%d" , &x , &y , &a , &b , &k);
        bool yes = 0;
        int dist = dist_f_t(a , b);
        if(dist % 2 == k % 2)
            yes |= 1;
        dist = dist_f_t(a , x) + dist_f_t(y , b) + 1;
        dist = min(dist , dist_f_t(a , y) + dist_f_t(x , b) + 1);
        if(dist % 2 == k % 2)
            yes |= 1;
        puts( (yes && dist <= k) ? "YES" : "NO");
    }
}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

const int N = 1e5+5;

int n;
int q;
vector < int > adj[N];
int bl[N][20] , depth[N];

void dfs(int u , int p){

     bl[u][0] = p;
     depth[u] = depth[p] + 1;

     int h = 1;
     while( (1 << h) <= depth[p] ){
        bl[u][h] = bl[ bl[u][h-1] ][h-1];
        h++;
     }

     for(auto v : adj[u]){
         if(v == p)
            continue;
         dfs(v , u);
     }
}

int getPBL(int u , int p){
    for(int i = 0; (1 << i) <= p; i++){
        if(p & (1 << i)){
            u = bl[u][i];
        }
    }
    return u;
}

int LCA(int u , int v){
    if(depth[u] < depth[v])
        swap(u , v);
    int must = depth[u] - depth[v];
    u = getPBL(u , must);
    if(u == v)
        return u;
    for(int i = 18; ~i; i--){
        if(bl[u][i] != bl[v][i]){
            u = bl[u][i];
            v = bl[v][i];
        }
    }
    return bl[u][0];
}

int dist_f_t(int a , int b){
    int lca = LCA(a , b);
    int dist = depth[a] + depth[b] - 2 * depth[lca];
    return dist;
}

int main(){
    scanf("%d" , &n);
    for(int i = 1; i < n; i++){
        int u , v;
        scanf("%d%d" , &u , &v);
        adj[u].push_back(v);
        adj[v].push_back(u);
    }
    dfs(1 , 0);
    scanf("%d" , &q);
    while(q--){
        int a , b , x , y , k;
        scanf("%d%d%d%d%d" , &x , &y , &a , &b , &k);
        bool yes = 0;
        int dist = dist_f_t(a , b);
        if(dist % 2 == k % 2)
            yes |= 1;
        //from a to x to y to b
        dist = dist_f_t(x , y);
        if(dist % 2 == 0 && dist)
            yes |= 1;
        puts(yes ? "YES" : "NO");
    }
}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

const int N = 1e5+5;

int n;
int q;
vector < int > adj[N];
int bl[N][20] , depth[N];

void dfs(int u , int p){

     bl[u][0] = p;
     depth[u] = depth[p] + 1;

     int h = 1;
     while( (1 << h) <= depth[p] ){
        bl[u][h] = bl[ bl[u][h-1] ][h-1];
        h++;
     }

     for(auto v : adj[u]){
         if(v == p)
            continue;
         dfs(v , u);
     }
}

int getPBL(int u , int p){
    for(int i = 0; (1 << i) <= p; i++){
        if(p & (1 << i)){
            u = bl[u][i];
        }
    }
    return u;
}

int LCA(int u , int v){
    if(depth[u] < depth[v])
        swap(u , v);
    int must = depth[u] - depth[v];
    u = getPBL(u , must);
    if(u == v)
        return u;
    for(int i = 18; ~i; i--){
        if(bl[u][i] != bl[v][i]){
            u = bl[u][i];
            v = bl[v][i];
        }
    }
    return bl[u][0];
}

int dist_f_t(int a , int b){
    int lca = LCA(a , b);
    int dist = depth[a] + depth[b] - 2 * depth[lca];
    return dist;
}

int main(){
    scanf("%d" , &n);
    for(int i = 1; i < n; i++){
        int u , v;
        scanf("%d%d" , &u , &v);
        adj[u].push_back(v);
        adj[v].push_back(u);
    }
    dfs(1 , 0);
    scanf("%d" , &q);
    while(q--){
        int a , b , x , y , k;
        scanf("%d%d%d%d%d" , &x , &y , &a , &b , &k);
        bool yes = 0;
        ll act = 1e18;
        int dist = dist_f_t(a , b);
        if(dist % 2 == k % 2)
            act = dist;
        dist = dist_f_t(a , x) + dist_f_t(y , b) + 1;
        dist = min(dist , dist_f_t(a , y) + dist_f_t(x , b) + 1);
        if(dist % 2 == k % 2)
            act = min(dist , act);
        puts( (act <= k) ? "YES" : "NO");
    }
}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

const int N = 1e5+5;

int n;
int q;
vector < int > adj[N];
int bl[N][20] , depth[N];

void dfs(int u , int p){

     bl[u][0] = p;
     depth[u] = depth[p] + 1;

     int h = 1;
     while( (1 << h) <= depth[p] ){
        bl[u][h] = bl[ bl[u][h-1] ][h-1];
        h++;
     }

     for(auto v : adj[u]){
         if(v == p)
            continue;
         dfs(v , u);
     }
}

int getPBL(int u , int p){
    for(int i = 0; (1 << i) <= p; i++){
        if(p & (1 << i)){
            u = bl[u][i];
        }
    }
    return u;
}

int LCA(int u , int v){
    if(depth[u] < depth[v])
        swap(u , v);
    int must = depth[u] - depth[v];
    u = getPBL(u , must);
    if(u == v)
        return u;
    for(int i = 18; ~i; i--){
        if(bl[u][i] != bl[v][i]){
            u = bl[u][i];
            v = bl[v][i];
        }
    }
    return bl[u][0];
}

int dist_f_t(int a , int b){
    int lca = LCA(a , b);
    int dist = depth[a] + depth[b] - 2 * depth[lca];
    return dist;
}

int main(){
    scanf("%d" , &n);
    for(int i = 1; i < n; i++){
        int u , v;
        scanf("%d%d" , &u , &v);
        adj[u].push_back(v);
        adj[v].push_back(u);
    }
    dfs(1 , 0);
    scanf("%d" , &q);
    while(q--){
        int a , b , x , y , k;
        scanf("%d%d%d%d%d" , &x , &y , &a , &b , &k);
        bool yes = 0;
        int dist = dist_f_t(a , b);
        if(dist % 2 == k % 2)
            yes |= 1;
        //from a to x to y to b
        dist = dist_f_t(x , y);
        if(dist % 2 == 0)
            yes |= 1;
        puts(yes ? "YES" : "NO");
    }
}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

const int N = 1e5+5;

int n;
int q;
vector < int > adj[N];
int bl[N][20] , depth[N];

void dfs(int u , int p){

     bl[u][0] = p;
     depth[u] = depth[p] + 1;

     int h = 1;
     while( (1 << h) <= depth[p] ){
        bl[u][h] = bl[ bl[u][h-1] ][h-1];
        h++;
     }

     for(auto v : adj[u]){
         if(v == p)
            continue;
         dfs(v , u);
     }
}

int getPBL(int u , int p){
    for(int i = 0; (1 << i) <= p; i++){
        if(p & (1 << i)){
            u = bl[u][i];
        }
    }
    return u;
}

int LCA(int u , int v){
    if(depth[u] < depth[v])
        swap(u , v);
    int must = depth[u] - depth[v];
    u = getPBL(u , must);
    if(u == v)
        return u;
    for(int i = 18; ~i; i--){
        if(bl[u][i] != bl[v][i]){
            u = bl[u][i];
            v = bl[v][i];
        }
    }
    return bl[u][0];
}

int dist_f_t(int a , int b){
    int lca = LCA(a , b);
    int dist = depth[a] + depth[b] - 2 * depth[lca];
    return dist;
}

int main(){
    scanf("%d" , &n);
    for(int i = 1; i < n; i++){
        int u , v;
        scanf("%d%d" , &u , &v);
        adj[u].push_back(v);
        adj[v].push_back(u);
    }
    dfs(1 , 0);
    scanf("%d" , &q);
    while(q--){
        int a , b , x , y , k;
        scanf("%d%d%d%d%d" , &x , &y , &a , &b , &k);
        bool yes = 0;
        ll act = 1e18;
        int dist = dist_f_t(a , b);
        if(dist % 2 == k % 2)
            act = dist;
        dist = dist_f_t(a , x) + dist_f_t(y , b) + 1;
        dist = min(dist , dist_f_t(a , y) + dist_f_t(x , b) + 1);
        if(dist % 2 == k % 2)
            act = min(1LL*dist , act);
        puts( (act <= k) ? "YES" : "NO");
    }
}


    // Khud ke baski to hai nai
    // isliye yaha dekhne aa gaye

//https://github.com/rafi-kamal/ACM-Solutions/blob/master/LightOj/String/1255%20-%20Substring%20Frequency.cpp

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;
void fast();
#define print(a)        for (auto x : a) cout << x << " "; cout << endl
#define print_upto(a,n)        for(int i=0;i<n;i++)    cout<<a[i]<<" "; cout<<endl
#define take(x,n)           for(int i=0;i<n;i++)  cin>>x[i];
#define rep(i,n)        for(int i=0;i<n;i++)
#define repange(i,a,b)      for(int i=a;i<=b;i++)
#define reprange(i,a,b)     for(int i=a;i>=b;i--)
#define okay    cout << "okay" << endl
#define hey     cout << "hey" << endl
#define ll long long
#define ull unsigned long long
#define ldob long double
#define dob double
#define F first
#define S second
#define pii pair<int, int>
#define vec(a) vector<a>
#define umap(a, b) unordered_map<a, b>
#define endl "\n"
#define inf 1e18
#define pb push_back
#define mp make_pair
#define mem(a,b) memset(a,b,sizeof(a))

//======================================================================================//

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
template <class T> ostream& operator << (ostream &os, const vector<T> &v) { for (T i : v) os << i << ", "; return os; }
template <class T> ostream& operator << (ostream &os, const set<T> &v) { for (T i : v) os << i << " "; return os; }
template <class T> ostream& operator << (ostream &os, const multiset<T> &v) { for (T i : v) os << i << " "; return os; }
template <class T, class S> ostream& operator << (ostream &os, const pair<T, S> &v) { os << v.F << ' ' << v.S; return os; }
template <class T, class S> ostream& operator << (ostream &os, const map<T, S> &v) { for (auto i : v) os << '(' << i.F << " => " << i.S << ')' << ' '; return os; }

typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;

#ifndef ONLINE_JUDGE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <class Arg1> void __f(const char* name, Arg1&& arg1) { cerr << name << " : " << arg1 << endl; }
    template <class Arg1, class... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args) {
        const char* sep = strchr(names + 1, ',');
        cerr.write(names, sep - names) << " : " << arg1 << "  ";
        __f(sep + 1, args...);
    }
#else
#define trace(...) 0
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("avx2,sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define _CRT_SECURE_NO_WARNINGS
#endif // ifndef ONLINE_JUDGE

clock_t time_p=clock();
void TTIIMMEE()
{
    time_p=clock()-time_p;
    cerr<<"Time Taken : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";
}

//======================================================================================//
#define MOD 1000000007
#define int long long int
#define N 200005

int ar[N];
int n,a,b,c,d,m,k,q,mod;
vec(int) v;

int level[N];
int parent[N];
#define dim ((int)(log2(N))+5)
int dp[dim][N];
list<int>adj[N];

void dfs(int cur,int par,int lev)
{
    level[cur]=lev;
    parent[cur]=par;
    for(auto it:adj[cur])
    {
        if(it==par) continue;
        dfs(it,cur,lev+1);
    }
}

void find_anc()
{
    rep(i,n)
        dp[0][i+1]=parent[i+1];

    for(int i=1;i<dim;i++)
    {
        for(int j=1;j<=n;j++)
        {
            dp[i][j]=dp[i-1][dp[i-1][j]];
        }
    }
}

int lca(int x,int y)
{
    if(x==y) return x;
    //if(level[x]>level[y]) swap(x,y);
    int diff = abs(level[x]-level[y]);

    while(diff)
    {
        int log=log2(diff);
        y=dp[log][y];
        diff-=(1<<log);
    }
    while(x!=y)
    {
        int i = log2(level[x]);
        while(i>0 && dp[i][x] == dp[i][y]) i--;

        x = dp[i][x];
        y = dp[i][y];
    }

    return a;
}

void precomp()
{
    dfs(1,0,0);
    find_anc();
}

int dist(int x,int y)
{
    //cout<<x<<","<<y<<lca(x,y)<<endl;

    // cout<<level[x]<<" ,  "<<lca(x,y)<<endl;
    // cout<<"returning "<<level[x]+level[y]-2*level[lca(x,y)]<<endl;
    return level[x]+level[y]-2*level[lca(x,y)];
}

void query()
{
    int x,y,a,b,k;
    cin>>x>>y>>a>>b>>k;

    int d1=dist(a,b);
    int d2=dist(a,x)+1+dist(y,b);
    int d3=dist(a,y)+1+dist(b,x);

    cout<<d1<<" "<<d2<<" "<<d3<<endl;

    if((k>=d1 && (k-d1)%2==0) or ((k>=d2 && (k-d2)%2==0)) or ((k>=d3 && (k-d3)%2==0)))
        cout<<"YES"<<endl;

    else cout<<"NO"<<endl;
    return;
}

int32_t main()
{
    fast();

    int t=1;    //change t if required
    //cin>>t;
    while(t--)
    {
        cin>>n;
        rep(i,n-1)
        {
            cin>>a>>b;
            adj[a].pb(b);
            adj[b].pb(a);
        }

        precomp();
        cin>>q;
        while(q--)
    {
        int x, y, a, b, k; cin>>x>>y>>a>>b>>k;
        if(level[a] < level[b]) swap(a, b);

        int xy = dist(x, y);

        int t = dist(a, b);
        int t1 = dist(a, x) + dist(b, y) + 1;
        int t4 = dist(a, y) + dist(b, x) + 1;

        if(t <= k && (k - t) % 2 == 0)
        {
            cout<<"YES\n";
            continue;
        }
        if(t1 <= k && (k - t1) % 2 == 0)
        {
            cout<<"YES\n";
            continue;
        }
        if(t4 <= k && (k - t4) % 2 == 0)
        {
            cout<<"YES\n";
            continue;
        }

        cout<<"NO\n";
    }
    }
    TTIIMMEE();
    return 0;
}

void fast()
{
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
}


//Binary lifting fuck yeah!!
//LCA

    // Khud ke baski to hai nai
    // isliye yaha dekhne aa gaye

//https://github.com/rafi-kamal/ACM-Solutions/blob/master/LightOj/String/1255%20-%20Substring%20Frequency.cpp

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;
void fast();
#define print(a)        for (auto x : a) cout << x << " "; cout << endl
#define print_upto(a,n)        for(int i=0;i<n;i++)    cout<<a[i]<<" "; cout<<endl
#define take(x,n)           for(int i=0;i<n;i++)  cin>>x[i];
#define rep(i,n)        for(int i=0;i<n;i++)
#define repange(i,a,b)      for(int i=a;i<=b;i++)
#define reprange(i,a,b)     for(int i=a;i>=b;i--)
#define okay    cout << "okay" << endl
#define hey     cout << "hey" << endl
#define uint unsigned long long
#define ldob long double
#define dob double
#define F first
#define S second
#define pii pair<int, int>
#define vec(a) vector<a>
#define umap(a, b) unordered_map<a, b>
#define endl "\n"
#define inf 1e18
#define pb push_back
#define mp make_pair
#define mem(a,b) memset(a,b,sizeof(a))

//======================================================================================//
#define MOD 1000000007
#define int long long int
#define N 200005

int ar[N];
int n,a,b,c,d,m,k,q,mod;
vec(int) v;
int level[N];
int parent[N];
int dp[log2(N)+5][N];

void dfs(int cur,int par,int lev)
{
    level[cur]=level;
    parent[cur]=par;
    for(auto it:adj[cur])
    {
        if(it==par) continue;
        dfs(it,cur,lev+1);
    }
}

void find_anc()
{
    rep(i,n)
        dp[0][i+1]=parent[i+1];

    for(int i=1;i<log2(N)+5;i++)
    {
        for(int j=1;j<=n;j++)
        {
            dp[i][j]=dp[i-1][dp[i-1][j]];
        }
    }
}

void lca(int x,int y)
{
    if(level[x]<level[y]) swap(x,y);
    int diff = level[x]-level[y];

    while(diff)
    {
        int log=log2(diff);
        y=dp[log][y];
        diff-=(1<<log);
    }
    while(x!=y)
    {
        int i = log2(level[x]);
        while(i>0 && dp[i][x] == dp[i][y]) i--;

        x = dp[i][x];
        y = dp[i][y];
    }

    return a;
}

void precomp()
{
    dfs(1,0,0);
    find_anc();
}

int dist(int x,int y)
{
    return level[x]+level[y]-2*level[lca(x,y)];
}

void query()
{
    int x,y,a,b,k;
    cin>>x>>y>>a>>b>>k;

    int d1=dist(a,b);
    int d2=dist(a,x)+1+dist(y,b);
    int d3=dist(a,y)+1+dist(b,x);

    if((k>=d1 && (k-d1)%2==0) or ((k>=d2 && (k-d2)%2==0)) or ((k>=d3 && (k-d3)%2==0)))
        cout<<"YES"<<endl;

    else cout<<"NO"<<endl;
    return;
}

int32_t main()
{
    fast();

    int t=1;    //change t if required
    //cin>>t;
    while(t--)
    {
        cin>>n;
        rep(i,n-1)
        {
            cin>>a>>b;
            adj[a].pb(b);
            adj[b].pb(a);
        }

        precomp();
        cin>>q;
        while(q--){
        query();
        }
    }
    return 0;
}

void fast()
{
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
}


//Binary lifting fuck yeah!!
//LCA

    // Khud ke baski to hai nai
    // isliye yaha dekhne aa gaye

//https://github.com/rafi-kamal/ACM-Solutions/blob/master/LightOj/String/1255%20-%20Substring%20Frequency.cpp

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;
void fast();
#define print(a)        for (auto x : a) cout << x << " "; cout << endl
#define print_upto(a,n)        for(int i=0;i<n;i++)    cout<<a[i]<<" "; cout<<endl
#define take(x,n)           for(int i=0;i<n;i++)  cin>>x[i];
#define rep(i,n)        for(int i=0;i<n;i++)
#define repange(i,a,b)      for(int i=a;i<=b;i++)
#define reprange(i,a,b)     for(int i=a;i>=b;i--)
#define okay    cout << "okay" << endl
#define hey     cout << "hey" << endl
#define uint unsigned long long
#define ldob long double
#define dob double
#define F first
#define S second
#define pii pair<int, int>
#define vec(a) vector<a>
#define umap(a, b) unordered_map<a, b>
#define endl "\n"
#define inf 1e18
#define pb push_back
#define mp make_pair
#define mem(a,b) memset(a,b,sizeof(a))

//======================================================================================//
#define MOD 1000000007
#define int long long int
#define N 200005

int ar[N];
int n,a,b,c,d,m,k,q,mod;
vec(int) v;
int level[N];
int parent[N];
#define dim ((int)(log2(N))+5)
int dp[dim][N];
list<int>adj[N];
void dfs(int a, int par, int lev)
{
    ::parent[a] = par;
    level[a] = lev;
    for(int i:adj[a])
    {
        if(i == par) continue;
        dfs(i, a, lev+1);
    }
}

void find_anc()
{
    for(int i=1;i<=n;i++)
    {
        dp[0][i] = parent[i];
    }

    for(int i=1;i<dim;i++)
    {
        for(int j=1;j<=n;j++)
        {
            dp[i][j] = dp[i-1][dp[i-1][j]];
        }
    }
}

int lca(int x,int y)
{
    if(level[x]<level[y]) swap(x,y);
    int diff = level[x]-level[y];

    while(diff)
    {
        int log=log2(diff);
        y=dp[log][y];
        diff-=(1<<log);
    }
    while(x!=y)
    {
        int i = log2(level[x]);
        while(i>0 && dp[i][x] == dp[i][y]) i--;

        x = dp[i][x];
        y = dp[i][y];
    }

    return a;
}

void precomp()
{
    dfs(1,0,0);
    find_anc();
}

int dist(int x,int y)
{
    return level[x]+level[y]-2*level[lca(x,y)];
}

void query()
{
    int x,y,a,b,k;
    cin>>x>>y>>a>>b>>k;

    int d1=dist(a,b);
    int d2=dist(a,x)+1+dist(y,b);
    int d3=dist(a,y)+1+dist(b,x);

    if((k>=d1 && (k-d1)%2==0) or ((k>=d2 && (k-d2)%2==0)) or ((k>=d3 && (k-d3)%2==0)))
        cout<<"YES"<<endl;

    else cout<<"NO"<<endl;
    return;
}

int32_t main()
{
    fast();

    int t=1;    //change t if required
    //cin>>t;
    while(t--)
    {
        cin>>n;
        rep(i,n-1)
        {
            cin>>a>>b;
            adj[a].pb(b);
            adj[b].pb(a);
        }

        precomp();
        cin>>q;
        while(q--){
        query();
        }
    }
    return 0;
}

void fast()
{
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
}


// LCA
//Binary lifting

#include <bits/stdc++.h>
using namespace std;

#define F first
#define S second
#define endl "\n"
#define pb push_back

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

template <class T> ostream& operator << (ostream &os, const vector<T> &v) { for (T i : v) os << i << ", "; return os; }
template <class T> ostream& operator << (ostream &os, const set<T> &v) { for (T i : v) os << i << " "; return os; }
template <class T> ostream& operator << (ostream &os, const multiset<T> &v) { for (T i : v) os << i << " "; return os; }
template <class T, class S> ostream& operator << (ostream &os, const pair<T, S> &v) { os << v.F << ' ' << v.S; return os; }
template <class T, class S> ostream& operator << (ostream &os, const map<T, S> &v) { for (auto i : v) os << '(' << i.F << " => " << i.S << ')' << ' '; return os; }

void fast()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}

const int N = 1e5 + 5;
vector<vector<int>> v(N);
vector<int> par(N), level(N), mx(N, 0);
vector<vector<int>> dp(log2(N)+5, vector<int>(N));
int n;

void dfs_lca(int a, int par, int lev)
{
    ::par[a] = par;
    level[a] = lev;
    for(int i:v[a])
    {
        if(i == par) continue;
        dfs_lca(i, a, lev+1);
    }
}

void find_ancestor()
{
    for(int i=1;i<=n;i++)
    {
        dp[0][i] = par[i];
    }

    for(int i=1;i<dp.size();i++)
    {
        for(int j=1;j<=n;j++)
        {
            dp[i][j] = dp[i-1][dp[i-1][j]];
        }
    }
}

ll lca(int a, int b)
{
    if(level[b] < level[a]) swap(a, b);

    int diff = level[b]-level[a];
    while(diff)
    {
        int log = log2(diff);
        b = dp[log][b];
        diff -= (1<<log);
    }
    while(a != b)
    {
        int i = log2(level[a]);
        while(i>0 && dp[i][a] == dp[i][b]) i--;

        a = dp[i][a];
        b = dp[i][b];
    }
    // return val; // if return max edge
    return a; // return ancestor
}

void compute_lca()
{
    dfs_lca(1, 0, 0);
    find_ancestor();
}

int dis(int a, int b)
{
    return level[a] + level[b] - level[lca(a, b)] * 2;
}

void solve()
{
    compute_lca();
    int q; cin>>q;
    while(q--)
    {
        int x, y, a, b, k; cin>>x>>y>>a>>b>>k;
        if(level[a] < level[b]) swap(a, b);

        int xy = dis(x, y);

        int t = dis(a, b);
        int t1 = dis(a, x) + dis(b, y) + 1;
        int t4 = dis(a, y) + dis(b, x) + 1;

        if(t <= k && (k - t) % 2 == 0)
        {
            cout<<"YES\n";
            continue;
        }
        if(t1 <= k && (k - t1) % 2 == 0)
        {
            cout<<"YES\n";
            continue;
        }
        if(t4 <= k && (k - t4) % 2 == 0)
        {
            cout<<"YES\n";
            continue;
        }

        cout<<"NO\n";
    }
}

int main()
{
    fast();
    cin>>n;
    for(int i = 1; i < n; i++)
    {
        int a, b; cin>>a>>b;
        v[a].pb(b);
        v[b].pb(a);
    }
    solve();
}


//Binary lifting fuck yeah!!
//LCA

    // Khud ke baski to hai nai
    // isliye yaha dekhne aa gaye

//https://github.com/rafi-kamal/ACM-Solutions/blob/master/LightOj/String/1255%20-%20Substring%20Frequency.cpp

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;
void fast();
#define print(a)        for (auto x : a) cout << x << " "; cout << endl
#define print_upto(a,n)        for(int i=0;i<n;i++)    cout<<a[i]<<" "; cout<<endl
#define take(x,n)           for(int i=0;i<n;i++)  cin>>x[i];
#define rep(i,n)        for(int i=0;i<n;i++)
#define repange(i,a,b)      for(int i=a;i<=b;i++)
#define reprange(i,a,b)     for(int i=a;i>=b;i--)
#define okay    cout << "okay" << endl
#define hey     cout << "hey" << endl
#define uint unsigned long long
#define ldob long double
#define dob double
#define F first
#define S second
#define pii pair<int, int>
#define vec(a) vector<a>
#define umap(a, b) unordered_map<a, b>
#define endl "\n"
#define inf 1e18
#define pb push_back
#define mp make_pair
#define mem(a,b) memset(a,b,sizeof(a))

//======================================================================================//
#define MOD 1000000007
#define int long long int
#define N 200005

int ar[N];
int n,a,b,c,d,m,k,q,mod;
vec(int) v;
int level[N];
int parent[N];
#define dim ((int)(log2(N))+5)
int dp[dim][N];
list<int>adj[N];

void dfs(int cur,int par,int lev)
{
    level[cur]=lev;
    parent[cur]=par;
    for(auto it:adj[cur])
    {
        if(it==par) continue;
        dfs(it,cur,lev+1);
    }
}

void find_anc()
{
    rep(i,n)
        dp[0][i+1]=parent[i+1];

    for(int i=1;i<log2(N)+5;i++)
    {
        for(int j=1;j<=n;j++)
        {
            dp[i][j]=dp[i-1][dp[i-1][j]];
        }
    }
}

int lca(int x,int y)
{
    if(level[x]<level[y]) swap(x,y);
    int diff = level[x]-level[y];

    while(diff)
    {
        int log=log2(diff);
        y=dp[log][y];
        diff-=(1<<log);
    }
    while(x!=y)
    {
        int i = log2(level[x]);
        while(i>0 && dp[i][x] == dp[i][y]) i--;

        x = dp[i][x];
        y = dp[i][y];
    }

    return a;
}

void precomp()
{
    dfs(1,0,0);
    find_anc();
}

int dist(int x,int y)
{
    return level[x]+level[y]-2*level[lca(x,y)];
}

void query()
{
    int x,y,a,b,k;
    cin>>x>>y>>a>>b>>k;

    int d1=dist(a,b);
    int d2=dist(a,x)+1+dist(y,b);
    int d3=dist(a,y)+1+dist(b,x);

    if((k>=d1 && (k-d1)%2==0) or ((k>=d2 && (k-d2)%2==0)) or ((k>=d3 && (k-d3)%2==0)))
        cout<<"YES"<<endl;

    else cout<<"NO"<<endl;
    return;
}

int32_t main()
{
    fast();

    int t=1;    //change t if required
    //cin>>t;
    while(t--)
    {
        cin>>n;
        rep(i,n-1)
        {
            cin>>a>>b;
            adj[a].pb(b);
            adj[b].pb(a);
        }

        precomp();
        cin>>q;
        while(q--){
        query();
        }
    }
    return 0;
}

void fast()
{
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
}


    // Khud ke baski to hai nai
    // isliye yaha dekhne aa gaye

//https://github.com/rafi-kamal/ACM-Solutions/blob/master/LightOj/String/1255%20-%20Substring%20Frequency.cpp

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;
void fast();
#define print(a)        for (auto x : a) cout << x << " "; cout << endl
#define print_upto(a,n)        for(int i=0;i<n;i++)    cout<<a[i]<<" "; cout<<endl
#define take(x,n)           for(int i=0;i<n;i++)  cin>>x[i];
#define rep(i,n)        for(int i=0;i<n;i++)
#define repange(i,a,b)      for(int i=a;i<=b;i++)
#define reprange(i,a,b)     for(int i=a;i>=b;i--)
#define okay    cout << "okay" << endl
#define hey     cout << "hey" << endl
#define ll long long
#define ull unsigned long long
#define ldob long double
#define dob double
#define F first
#define S second
#define pii pair<int, int>
#define vec(a) vector<a>
#define umap(a, b) unordered_map<a, b>
#define endl "\n"
#define inf 1e18
#define pb push_back
#define mp make_pair
#define mem(a,b) memset(a,b,sizeof(a))

//======================================================================================//

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
template <class T> ostream& operator << (ostream &os, const vector<T> &v) { for (T i : v) os << i << ", "; return os; }
template <class T> ostream& operator << (ostream &os, const set<T> &v) { for (T i : v) os << i << " "; return os; }
template <class T> ostream& operator << (ostream &os, const multiset<T> &v) { for (T i : v) os << i << " "; return os; }
template <class T, class S> ostream& operator << (ostream &os, const pair<T, S> &v) { os << v.F << ' ' << v.S; return os; }
template <class T, class S> ostream& operator << (ostream &os, const map<T, S> &v) { for (auto i : v) os << '(' << i.F << " => " << i.S << ')' << ' '; return os; }

typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;

#ifndef ONLINE_JUDGE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <class Arg1> void __f(const char* name, Arg1&& arg1) { cerr << name << " : " << arg1 << endl; }
    template <class Arg1, class... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args) {
        const char* sep = strchr(names + 1, ',');
        cerr.write(names, sep - names) << " : " << arg1 << "  ";
        __f(sep + 1, args...);
    }
#else
#define trace(...) 0
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("avx2,sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define _CRT_SECURE_NO_WARNINGS
#endif // ifndef ONLINE_JUDGE

clock_t time_p=clock();
void TTIIMMEE()
{
    time_p=clock()-time_p;
    cerr<<"Time Taken : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";
}

//======================================================================================//
#define MOD 1000000007
#define int long long int
#define N 200005

int ar[N];
int n,a,b,c,d,m,k,q,mod;
vec(int) v;

int level[N];
int parent[N];
#define dim ((int)(log2(N))+5)
int dp[dim][N];
list<int>adj[N];

void dfs(int cur,int par,int lev)
{
    level[cur]=lev;
    parent[cur]=par;
    for(auto it:adj[cur])
    {
        if(it==par) continue;
        dfs(it,cur,lev+1);
    }
}

void find_anc()
{
    rep(i,n)
        dp[0][i+1]=parent[i+1];

    for(int i=1;i<dim;i++)
    {
        for(int j=1;j<=n;j++)
        {
            dp[i][j]=dp[i-1][dp[i-1][j]];
        }
    }
}

int lca(int x,int y)
{
    if(level[x]<level[y]) swap(x,y);
    int diff = level[x]-level[y];

    while(diff)
    {
        int log=log2(diff);
        y=dp[log][y];
        diff-=(1<<log);
    }
    while(x!=y)
    {
        int i = log2(level[x]);
        while(i>0 && dp[i][x] == dp[i][y]) i--;

        x = dp[i][x];
        y = dp[i][y];
    }

    return a;
}

void precomp()
{
    dfs(1,0,0);
    find_anc();
}

int dist(int x,int y)
{
    return level[x]+level[y]-2*level[lca(x,y)];
}

void query()
{
    int x,y,a,b,k;
    cin>>x>>y>>a>>b>>k;

    int d1=dist(a,b);
    int d2=dist(a,x)+1+dist(y,b);
    int d3=dist(a,y)+1+dist(b,x);

    if((k>=d1 && (k-d1)%2==0) or ((k>=d2 && (k-d2)%2==0)) or ((k>=d3 && (k-d3)%2==0)))
        cout<<"YES"<<endl;

    else cout<<"NO"<<endl;
    return;
}

int32_t main()
{
    fast();

    int t=1;    //change t if required
    //cin>>t;
    while(t--)
    {
        cin>>n;
        rep(i,n-1)
        {
            cin>>a>>b;
            adj[a].pb(b);
            adj[b].pb(a);
        }

        precomp();
        cin>>q;
        while(q--){
        query();
        }
    }
    TTIIMMEE();
    return 0;
}

void fast()
{
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
}


//Binary lifting fuck yeah!!
//LCA

    // Khud ke baski to hai nai
    // isliye yaha dekhne aa gaye

//https://github.com/rafi-kamal/ACM-Solutions/blob/master/LightOj/String/1255%20-%20Substring%20Frequency.cpp

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;
void fast();
#define print(a)        for (auto x : a) cout << x << " "; cout << endl
#define print_upto(a,n)        for(int i=0;i<n;i++)    cout<<a[i]<<" "; cout<<endl
#define take(x,n)           for(int i=0;i<n;i++)  cin>>x[i];
#define rep(i,n)        for(int i=0;i<n;i++)
#define repange(i,a,b)      for(int i=a;i<=b;i++)
#define reprange(i,a,b)     for(int i=a;i>=b;i--)
#define okay    cout << "okay" << endl
#define hey     cout << "hey" << endl
#define uint unsigned long long
#define ldob long double
#define dob double
#define F first
#define S second
#define pii pair<int, int>
#define vec(a) vector<a>
#define umap(a, b) unordered_map<a, b>
#define endl "\n"
#define inf 1e18
#define pb push_back
#define mp make_pair
#define mem(a,b) memset(a,b,sizeof(a))

//======================================================================================//
#define MOD 1000000007
//#define int long long int
#define N 200005

int ar[N];
int n,a,b,c,d,m,k,q,mod;
vec(int) v;
int level[N];
int parent[N];
#define dim ((int)(log2(N))+5)
int dp[dim][N];
list<int>adj[N];

void dfs(int cur,int par,int lev)
{
    level[cur]=lev;
    parent[cur]=par;
    for(auto it:adj[cur])
    {
        if(it==par) continue;
        dfs(it,cur,lev+1);
    }
}

void find_anc()
{
    rep(i,n)
        dp[0][i+1]=parent[i+1];

    for(int i=1;i<log2(N)+5;i++)
    {
        for(int j=1;j<=n;j++)
        {
            dp[i][j]=dp[i-1][dp[i-1][j]];
        }
    }
}

int lca(int x,int y)
{
    if(level[x]<level[y]) swap(x,y);
    int diff = level[x]-level[y];

    while(diff)
    {
        int log=log2(diff);
        y=dp[log][y];
        diff-=(1<<log);
    }
    while(x!=y)
    {
        int i = log2(level[x]);
        while(i>0 && dp[i][x] == dp[i][y]) i--;

        x = dp[i][x];
        y = dp[i][y];
    }

    return a;
}

void precomp()
{
    dfs(1,0,0);
    find_anc();
}

int dist(int x,int y)
{
    return level[x]+level[y]-2*level[lca(x,y)];
}

void query()
{
    int x,y,a,b,k;
    cin>>x>>y>>a>>b>>k;

    int d1=dist(a,b);
    int d2=dist(a,x)+1+dist(y,b);
    int d3=dist(a,y)+1+dist(b,x);

    if((k>=d1 && (k-d1)%2==0) or ((k>=d2 && (k-d2)%2==0)) or ((k>=d3 && (k-d3)%2==0)))
        cout<<"YES"<<endl;

    else cout<<"NO"<<endl;
    return;
}

int32_t main()
{
    fast();

    int t=1;    //change t if required
    //cin>>t;
    while(t--)
    {
        cin>>n;
        rep(i,n-1)
        {
            cin>>a>>b;
            adj[a].pb(b);
            adj[b].pb(a);
        }

        precomp();
        cin>>q;
        while(q--){
        query();
        }
    }
    return 0;
}

void fast()
{
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
}


    // Khud ke baski to hai nai
    // isliye yaha dekhne aa gaye

//https://github.com/rafi-kamal/ACM-Solutions/blob/master/LightOj/String/1255%20-%20Substring%20Frequency.cpp

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;
void fast();
#define print(a)        for (auto x : a) cout << x << " "; cout << endl
#define print_upto(a,n)        for(int i=0;i<n;i++)    cout<<a[i]<<" "; cout<<endl
#define take(x,n)           for(int i=0;i<n;i++)  cin>>x[i];
#define rep(i,n)        for(int i=0;i<n;i++)
#define repange(i,a,b)      for(int i=a;i<=b;i++)
#define reprange(i,a,b)     for(int i=a;i>=b;i--)
#define okay    cout << "okay" << endl
#define hey     cout << "hey" << endl
#define ll long long
#define ull unsigned long long
#define ldob long double
#define dob double
#define F first
#define S second
#define pii pair<int, int>
#define vec(a) vector<a>
#define umap(a, b) unordered_map<a, b>
#define endl "\n"
#define inf 1e18
#define pb push_back
#define mp make_pair
#define mem(a,b) memset(a,b,sizeof(a))

//======================================================================================//

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
template <class T> ostream& operator << (ostream &os, const vector<T> &v) { for (T i : v) os << i << ", "; return os; }
template <class T> ostream& operator << (ostream &os, const set<T> &v) { for (T i : v) os << i << " "; return os; }
template <class T> ostream& operator << (ostream &os, const multiset<T> &v) { for (T i : v) os << i << " "; return os; }
template <class T, class S> ostream& operator << (ostream &os, const pair<T, S> &v) { os << v.F << ' ' << v.S; return os; }
template <class T, class S> ostream& operator << (ostream &os, const map<T, S> &v) { for (auto i : v) os << '(' << i.F << " => " << i.S << ')' << ' '; return os; }

typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;

#ifndef ONLINE_JUDGE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <class Arg1> void __f(const char* name, Arg1&& arg1) { cerr << name << " : " << arg1 << endl; }
    template <class Arg1, class... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args) {
        const char* sep = strchr(names + 1, ',');
        cerr.write(names, sep - names) << " : " << arg1 << "  ";
        __f(sep + 1, args...);
    }
#else
#define trace(...) 0
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("avx2,sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define _CRT_SECURE_NO_WARNINGS
#endif // ifndef ONLINE_JUDGE

clock_t time_p=clock();
void TTIIMMEE()
{
    time_p=clock()-time_p;
    cerr<<"Time Taken : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";
}

//======================================================================================//
#define MOD 1000000007
#define int long long int
#define N 200005

int ar[N];
int n,a,b,c,d,m,k,q,mod;
vec(int) v;

int level[N];
int parent[N];
#define dim ((int)(log2(N))+5)
int dp[dim][N];
list<int>adj[N];

void dfs(int cur,int par,int lev)
{
    level[cur]=lev;
    parent[cur]=par;
    for(auto it:adj[cur])
    {
        if(it==par) continue;
        dfs(it,cur,lev+1);
    }
}

void find_anc()
{
    rep(i,n)
        dp[0][i+1]=parent[i+1];

    for(int i=1;i<dim;i++)
    {
        for(int j=1;j<=n;j++)
        {
            dp[i][j]=dp[i-1][dp[i-1][j]];
        }
    }
}

int lca(int x,int y)
{
    if(x==y) return x;
    if(level[x]<level[y]) swap(x,y);
    int diff = level[x]-level[y];

    while(diff)
    {
        int log=log2(diff);
        y=dp[log][y];
        diff-=(1<<log);
    }
    while(x!=y)
    {
        int i = log2(level[x]);
        while(i>0 && dp[i][x] == dp[i][y]) i--;

        x = dp[i][x];
        y = dp[i][y];
    }

    return a;
}

void precomp()
{
    dfs(1,0,0);
    find_anc();
}

int dist(int x,int y)
{
    //cout<<x<<","<<y<<lca(x,y)<<endl;

    // cout<<level[x]<<" ,  "<<lca(x,y)<<endl;
    // cout<<"returning "<<level[x]+level[y]-2*level[lca(x,y)]<<endl;
    return level[x]+level[y]-2*level[lca(x,y)];
}

void query()
{
    int x,y,a,b,k;
    cin>>x>>y>>a>>b>>k;

    int d1=dist(a,b);
    int d2=dist(a,x)+1+dist(y,b);
    int d3=dist(a,y)+1+dist(b,x);

    cout<<d1<<" "<<d2<<" "<<d3<<endl;

    if((k>=d1 && (k-d1)%2==0) or ((k>=d2 && (k-d2)%2==0)) or ((k>=d3 && (k-d3)%2==0)))
        cout<<"YES"<<endl;

    else cout<<"NO"<<endl;
    return;
}

int32_t main()
{
    fast();

    int t=1;    //change t if required
    //cin>>t;
    while(t--)
    {
        cin>>n;
        rep(i,n-1)
        {
            cin>>a>>b;
            adj[a].pb(b);
            adj[b].pb(a);
        }

        precomp();
        cin>>q;
        while(q--)
    {
        int x, y, a, b, k; cin>>x>>y>>a>>b>>k;
        if(level[a] < level[b]) swap(a, b);

        int xy = dist(x, y);

        int t = dist(a, b);
        int t1 = dist(a, x) + dist(b, y) + 1;
        int t4 = dist(a, y) + dist(b, x) + 1;

        if(t <= k && (k - t) % 2 == 0)
        {
            cout<<"YES\n";
            continue;
        }
        if(t1 <= k && (k - t1) % 2 == 0)
        {
            cout<<"YES\n";
            continue;
        }
        if(t4 <= k && (k - t4) % 2 == 0)
        {
            cout<<"YES\n";
            continue;
        }

        cout<<"NO\n";
    }
    }
    TTIIMMEE();
    return 0;
}

void fast()
{
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
}


//Binary lifting fuck yeah!!
//LCA

    // Khud ke baski to hai nai
    // isliye yaha dekhne aa gaye

//https://github.com/rafi-kamal/ACM-Solutions/blob/master/LightOj/String/1255%20-%20Substring%20Frequency.cpp

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;
void fast();
#define print(a)        for (auto x : a) cout << x << " "; cout << endl
#define print_upto(a,n)        for(int i=0;i<n;i++)    cout<<a[i]<<" "; cout<<endl
#define take(x,n)           for(int i=0;i<n;i++)  cin>>x[i];
#define rep(i,n)        for(int i=0;i<n;i++)
#define repange(i,a,b)      for(int i=a;i<=b;i++)
#define reprange(i,a,b)     for(int i=a;i>=b;i--)
#define okay    cout << "okay" << endl
#define hey     cout << "hey" << endl
#define uint unsigned long long
#define ldob long double
#define dob double
#define F first
#define S second
#define pii pair<int, int>
#define vec(a) vector<a>
#define umap(a, b) unordered_map<a, b>
#define endl "\n"
#define inf 1e18
#define pb push_back
#define mp make_pair
#define mem(a,b) memset(a,b,sizeof(a))

//======================================================================================//
#define MOD 1000000007
#define int long long int
#define N 200005

int ar[N];
int n,a,b,c,d,m,k,q,mod;
vec(int) v;
int level[N];
int parent[N];
#define dim ((int)(log2(N))+5)
int dp[dim][N];
list<int>adj[N];
void dfs(int a, int par, int lev)
{
    ::parent[a] = par;
    level[a] = lev;
    for(int i:adj[a])
    {
        if(i == par) continue;
        dfs(i, a, lev+1);
    }
}

void find_anc()
{
    for(int i=1;i<=n;i++)
    {
        dp[0][i] = parent[i];
    }

    for(int i=1;i<dim;i++)
    {
        for(int j=1;j<=n;j++)
        {
            dp[i][j] = dp[i-1][dp[i-1][j]];
        }
    }
}

int lca(int a, int b)
{
    if(level[b] < level[a]) swap(a, b);

    int diff = level[b]-level[a];
    while(diff)
    {
        int log = log2(diff);
        b = dp[log][b];
        diff -= (1<<log);
    }
    while(a != b)
    {
        int i = log2(level[a]);
        while(i>0 && dp[i][a] == dp[i][b]) i--;

        a = dp[i][a];
        b = dp[i][b];
    }
    // return val; // if return max edge
    return a; // return ancestor
}

void compute_lca()
{
    dfs(1, 0, 0);
    find_anc();
}

int dist(int x,int y)
{
    return level[x]+level[y]-2*level[lca(x,y)];
}

void query()
{
    int x,y,a,b,k;
    cin>>x>>y>>a>>b>>k;

    int d1=dist(a,b);
    int d2=dist(a,x)+1+dist(y,b);
    int d3=dist(a,y)+1+dist(b,x);

    if((k>=d1 && (k-d1)%2==0) or ((k>=d2 && (k-d2)%2==0)) or ((k>=d3 && (k-d3)%2==0)))
        cout<<"YES"<<endl;

    else cout<<"NO"<<endl;
    return;
}

int32_t main()
{
    fast();

    int t=1;    //change t if required
    //cin>>t;
    while(t--)
    {
        cin>>n;
        rep(i,n-1)
        {
            cin>>a>>b;
            adj[a].pb(b);
            adj[b].pb(a);
        }

        compute_lca();
        cin>>q;
        while(q--){
        query();
        }
    }
    return 0;
}

void fast()
{
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
}


#include <iostream>
#include <string>
#include <cstring>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <algorithm>
#include <map>
#include <fstream>

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef tuple<int, int, int> iii;
typedef vector<iii> viii;
typedef priority_queue<int> pqi;
typedef priority_queue<ii> pqii;
typedef map<int, int> mii;
typedef map<int, string> mis;
typedef map<string, int> msi;
typedef set<int> si;
typedef set<ll> sl;
typedef map<ll, ll> mll;
typedef queue<int> qi;
typedef queue<ii> qii;
typedef vector<string> vs;
typedef pair<ll, ll> iil;
typedef vector<iil> viil;

#define pb push_back
#define mp make_pair
#define rep(i, n) for (int i = 0 ; i < n ; i++)
#define INF 1000000000

vi adj[200005];
vi bb;
vi cc;
bool vis[200005];
int n;
ii rng[200005];
int a[200005];
int s[200005];
int ds[200005];
int f[200005];

int rangeMin(int a, int b) {
    if (a == b) {
        return bb[a];
    }
    a += n;
    b += n;
    int sm = 1000000000;
    while (a <= b) {
        if (a % 2 == 1) {
            sm = min(sm, s[a]);
            a++;
        }
        if (b % 2 == 0) {
            sm = min(sm, s[b]);
            b--;
        }
        a /= 2;
        b /= 2;
    }
    return sm;
}

void dfs(int n, int d) {

    vis[n] = true;
    ds[n] = d;
    bb.push_back(ds[n]);
    cc.push_back(n);
    bool f = false;
    for (int a : adj[n]) {
        if (vis[a]) {
            continue;
        }
        f = true;
        dfs(a, d + 1);
        bb.push_back(ds[n]);
        cc.push_back(n);
    }
    //if (f) {
        //bb.push_back(n);
    //}
}

int dst(int a, int b) {
    int x = f[a];
    int y = f[b];
    int ans;
    if (x <= y) {
        ans = rangeMin(f[a], f[b]);
    }
    else {
        ans = rangeMin(f[b], f[a]);
    }

    return ds[a] + ds[b] - ans * 2;
}

void solve() {
    memset(vis, false, sizeof vis);
    cin >> n;
    rep(i, n - 1) {
        int aa, bbb;
        cin >> aa >> bbb;
        aa--; bbb--;
        adj[aa].pb(bbb);
        adj[bbb].pb(aa);
    }

    dfs(0, 0);
    n = 0;
    for (int i = cc.size() - 1 ; i >= 0 ; i--) {
        a[i] = bb[i];
        f[cc[i]] = i;
        n++;
    }

    int x = log(n) / log(2);
    x++;

    while (n != (1 << x) && n != (1 << (x - 1))) {
        n++;
        a[n - 1] = 0;
    }

    int p = (int)(log(n)/log(2));
    int pp = pow(2, p);

    memset(s, 0, sizeof s);
    for (int i = 0 ; i < n * 2 ; i++) {
        s[i] = 1000000000;
    }

    for (int i = 0 ; i < n ; i++) {
        int ind = pp + i;
        s[ind] = min(s[ind], a[i]);
        while (ind > 0) {
            ind /= 2;
            s[ind] = min(s[ind], a[i]);
        }
    }

    int q;
    cin >> q;
    cout << endl;
    rep(i, q) {
        int x, y, a, b, k; cin >> x >> y >> a >> b >> k;

        x--; y--; a--; b--;
        int d1 = dst(a, b);
        int d2 = dst(a, x) + dst(b, y) + 1;
        int d3 = dst(a, y) + dst(b, x) + 1;
        int dss[3] = {d1, d2, d3};
        bool f = false;
        for (int e : dss) {
            //cout << e << endl;
            if (e <= k && e % 2 == k % 2) {
                f = true;
            }
        }

        if (f) {
            cout << "YES" << '\n';
        }
        else {
            cout << "NO" << '\n';
        }
    }
}

void querySolve() {
    int n;
    cin >> n;
    while (n--) {
        solve();
    }
}

int main() {
    //querySolve();
    solve();
}


#include <iostream>
#include <string>
#include <cstring>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <algorithm>
#include <map>
#include <fstream>

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef tuple<int, int, int> iii;
typedef vector<iii> viii;
typedef priority_queue<int> pqi;
typedef priority_queue<ii> pqii;
typedef map<int, int> mii;
typedef map<int, string> mis;
typedef map<string, int> msi;
typedef set<int> si;
typedef set<ll> sl;
typedef map<ll, ll> mll;
typedef queue<int> qi;
typedef queue<ii> qii;
typedef vector<string> vs;
typedef pair<ll, ll> iil;
typedef vector<iil> viil;

#define pb push_back
#define mp make_pair
#define rep(i, n) for (int i = 0 ; i < n ; i++)
#define INF 1000000000

vi adj[200005];
vi bb;
bool vis[200005];
int n;
ii rng[200005];
int a[200005];
int s[200005];
int ds[200005];
int f[200005];

int rangeMin(int a, int b) {
    a += n;
    b += n;
    int sm = 1000000000;
    while (a <= b) {
        if (a % 2 == 1) {
            sm = min(sm, s[a]);
            a++;
        }
        if (b % 2 == 0) {
            sm = min(sm, s[b]);
            b--;
        }
        a /= 2;
        b /= 2;
    }
    return sm;
}

void dfs(int n, int d) {
    bb.push_back(n);
    vis[n] = true;
    ds[n] = d;
    bool f = false;
    for (int a : adj[n]) {
        if (vis[a]) {
            continue;
        }
        f = true;
        dfs(a, d + 1);
        bb.push_back(ds[n]);
    }
    //if (f) {
        //bb.push_back(n);
    //}
}

int dst(int a, int b) {
    int x = f[a];
    int y = f[b];
    int ans;
    if (x <= y) {
        ans = rangeMin(f[a], f[b]);
    }
    else {
        ans = rangeMin(f[b], f[a]);
    }
    return ds[a] + ds[b] - ds[ans] * 2;
}

void solve() {
    memset(vis, false, sizeof vis);
    cin >> n;
    rep(i, n - 1) {
        int aa, bbb;
        cin >> aa >> bbb;
        aa--; bbb--;
        adj[aa].pb(bbb);
        adj[bbb].pb(aa);
    }

    dfs(0, 0);
    n = 0;
    for (int i = bb.size() - 1 ; i >= 0 ; i--) {
        a[i] = bb[i];
        f[bb[i]] = i;
        n++;
    }

    while (abs((int)(log(n)/log(2)) - (log(n)/log(2))) > 0.00000001) {
        n++;
        a[n - 1] = 0;
    }

    int p = (int)(log(n)/log(2));
    int pp = pow(2, p);

    memset(s, 0, sizeof s);
    for (int i = 0 ; i < n * 2 ; i++) {
        s[i] = 1000000000;
    }

    for (int i = 0 ; i < n ; i++) {
        int ind = pp + i;
        s[ind] = min(s[ind], a[i]);
        while (ind > 0) {
            ind /= 2;
            s[ind] = min(s[ind], a[i]);
        }
    }

    int q;
    cin >> q;
    rep(i, q) {
        int x, y, a, b, k; cin >> x >> y >> a >> b >> k;
        x--; y--; a--; b--;
        int d1 = dst(a, b);
        int d2 = dst(a, x) + dst(b, y) + 1;
        int d3 = dst(a, y) + dst(b, x) + 1;
        int dss[3] = {d1, d2, d3};
        bool f = false;
        for (int e : dss) {
            if (e <= k && e % 2 == k % 2) {
                f = true;
            }
        }

        if (f) {
            cout << "YES" << '\n';
        }
        else {
            cout << "NO" << '\n';
        }
    }
}

void querySolve() {
    int n;
    cin >> n;
    while (n--) {
        solve();
    }
}

int main() {
    //querySolve();
    solve();
}


#include <iostream>
#include <string>
#include <cstring>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <algorithm>
#include <map>
#include <fstream>

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef tuple<int, int, int> iii;
typedef vector<iii> viii;
typedef priority_queue<int> pqi;
typedef priority_queue<ii> pqii;
typedef map<int, int> mii;
typedef map<int, string> mis;
typedef map<string, int> msi;
typedef set<int> si;
typedef set<ll> sl;
typedef map<ll, ll> mll;
typedef queue<int> qi;
typedef queue<ii> qii;
typedef vector<string> vs;
typedef pair<ll, ll> iil;
typedef vector<iil> viil;

#define pb push_back
#define mp make_pair
#define rep(i, n) for (int i = 0 ; i < n ; i++)
#define INF 1000000000

vi adj[200005];
vi bb;
vi cc;
bool vis[200005];
int n;
ii rng[200005];
int a[200005];
int s[200005];
int ds[200005];
int f[200005];

int rangeMin(int a, int b) {
    if (a == b) {
        return bb[a];
    }
    a += n;
    b += n;
    int sm = 1000000000;
    while (a <= b) {
        if (a % 2 == 1) {
            sm = min(sm, s[a]);
            a++;
        }
        if (b % 2 == 0) {
            sm = min(sm, s[b]);
            b--;
        }
        a /= 2;
        b /= 2;
    }
    return sm;
}

void dfs(int n, int d) {

    vis[n] = true;
    ds[n] = d;
    bb.push_back(ds[n]);
    cc.push_back(n);
    bool f = false;
    for (int a : adj[n]) {
        if (vis[a]) {
            continue;
        }
        f = true;
        dfs(a, d + 1);
        bb.push_back(ds[n]);
        cc.push_back(n);
    }
    //if (f) {
        //bb.push_back(n);
    //}
}

int dst(int a, int b) {
    int x = f[a];
    int y = f[b];
    int ans;
    if (x <= y) {
        ans = rangeMin(f[a], f[b]);
    }
    else {
        ans = rangeMin(f[b], f[a]);
    }

    return ds[a] + ds[b] - ans * 2;
}

void solve() {
    memset(vis, false, sizeof vis);
    cin >> n;
    rep(i, n - 1) {
        int aa, bbb;
        cin >> aa >> bbb;
        aa--; bbb--;
        adj[aa].pb(bbb);
        adj[bbb].pb(aa);
    }

    dfs(0, 0);
    n = 0;
    for (int i = cc.size() - 1 ; i >= 0 ; i--) {
        a[i] = bb[i];
        f[cc[i]] = i;
        n++;
    }

    while (abs((int)(log(n)/log(2)) - (log(n)/log(2))) > 0.00000001) {
        n++;
        a[n - 1] = 0;
    }

    int p = (int)(log(n)/log(2));
    int pp = pow(2, p);

    memset(s, 0, sizeof s);
    for (int i = 0 ; i < n * 2 ; i++) {
        s[i] = 1000000000;
    }

    for (int i = 0 ; i < n ; i++) {
        int ind = pp + i;
        s[ind] = min(s[ind], a[i]);
        while (ind > 0) {
            ind /= 2;
            s[ind] = min(s[ind], a[i]);
        }
    }

    int q;
    cin >> q;
    cout << endl;
    rep(i, q) {
        int x, y, a, b, k; cin >> x >> y >> a >> b >> k;

        x--; y--; a--; b--;
        int d1 = dst(a, b);
        int d2 = dst(a, x) + dst(b, y) + 1;
        int d3 = dst(a, y) + dst(b, x) + 1;
        int dss[3] = {d1, d2, d3};
        bool f = false;
        for (int e : dss) {
            //cout << e << endl;
            if (e <= k && e % 2 == k % 2) {
                f = true;
            }
        }

        if (f) {
            cout << "YES" << '\n';
        }
        else {
            cout << "NO" << '\n';
        }
    }
}

void querySolve() {
    int n;
    cin >> n;
    while (n--) {
        solve();
    }
}

int main() {
    //querySolve();
    solve();
}


#include <iostream>
#include <string>
#include <cstring>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <algorithm>
#include <map>
#include <fstream>

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef tuple<int, int, int> iii;
typedef vector<iii> viii;
typedef priority_queue<int> pqi;
typedef priority_queue<ii> pqii;
typedef map<int, int> mii;
typedef map<int, string> mis;
typedef map<string, int> msi;
typedef set<int> si;
typedef set<ll> sl;
typedef map<ll, ll> mll;
typedef queue<int> qi;
typedef queue<ii> qii;
typedef vector<string> vs;
typedef pair<ll, ll> iil;
typedef vector<iil> viil;

#define pb push_back
#define mp make_pair
#define rep(i, n) for (int i = 0 ; i < n ; i++)
#define INF 1000000000

vi adj[200005];
vi bb;
vi cc;
bool vis[200005];
int n;
ii rng[200005];
int a[200005];
int s[200005];
int ds[200005];
int f[200005];

int rangeMin(int a, int b) {
    if (a == b) {
        return bb[a];
    }
    a += n;
    b += n;
    int sm = 1000000000;
    while (a <= b) {
        if (a % 2 == 1) {
            sm = min(sm, s[a]);
            a++;
        }
        if (b % 2 == 0) {
            sm = min(sm, s[b]);
            b--;
        }
        a /= 2;
        b /= 2;
    }
    return sm;
}

void dfs(int n, int d) {

    vis[n] = true;
    ds[n] = d;
    bb.push_back(ds[n]);
    cc.push_back(n);
    bool f = false;
    for (int a : adj[n]) {
        if (vis[a]) {
            continue;
        }
        f = true;
        dfs(a, d + 1);
        bb.push_back(ds[n]);
        cc.push_back(n);
    }
    //if (f) {
        //bb.push_back(n);
    //}
}

int dst(int a, int b) {
    int x = f[a];
    int y = f[b];
    int ans;
    if (x <= y) {
        ans = rangeMin(f[a], f[b]);
    }
    else {
        ans = rangeMin(f[b], f[a]);
    }

    return ds[a] + ds[b] - ans * 2;
}

void solve() {
    memset(vis, false, sizeof vis);
    cin >> n;
    rep(i, n - 1) {
        int aa, bbb;
        cin >> aa >> bbb;
        aa--; bbb--;
        adj[aa].pb(bbb);
        adj[bbb].pb(aa);
    }

    dfs(0, 0);
    n = 0;
    for (int i = cc.size() - 1 ; i >= 0 ; i--) {
        a[i] = bb[i];
        f[cc[i]] = i;
        n++;
    }

    while ((int)(log(n)/log(2)) != (log(n)/log(2))) {
        n++;
        a[n - 1] = 0;
    }

    int p = (int)(log(n)/log(2));
    int pp = pow(2, p);

    memset(s, 0, sizeof s);
    for (int i = 0 ; i < n * 2 ; i++) {
        s[i] = 1000000000;
    }

    for (int i = 0 ; i < n ; i++) {
        int ind = pp + i;
        s[ind] = min(s[ind], a[i]);
        while (ind > 0) {
            ind /= 2;
            s[ind] = min(s[ind], a[i]);
        }
    }

    int q;
    cin >> q;
    cout << endl;
    rep(i, q) {
        int x, y, a, b, k; cin >> x >> y >> a >> b >> k;

        x--; y--; a--; b--;
        int d1 = dst(a, b);
        int d2 = dst(a, x) + dst(b, y) + 1;
        int d3 = dst(a, y) + dst(b, x) + 1;
        int dss[3] = {d1, d2, d3};
        bool f = false;
        for (int e : dss) {
            //cout << e << endl;
            if (e <= k && e % 2 == k % 2) {
                f = true;
            }
        }

        if (f) {
            cout << "YES" << '\n';
        }
        else {
            cout << "NO" << '\n';
        }
    }
}

void querySolve() {
    int n;
    cin >> n;
    while (n--) {
        solve();
    }
}

int main() {
    //querySolve();
    solve();
}


#include <iostream>
#include <string>
#include <cstring>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <algorithm>
#include <map>
#include <fstream>

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef tuple<int, int, int> iii;
typedef vector<iii> viii;
typedef priority_queue<int> pqi;
typedef priority_queue<ii> pqii;
typedef map<int, int> mii;
typedef map<int, string> mis;
typedef map<string, int> msi;
typedef set<int> si;
typedef set<ll> sl;
typedef map<ll, ll> mll;
typedef queue<int> qi;
typedef queue<ii> qii;
typedef vector<string> vs;
typedef pair<ll, ll> iil;
typedef vector<iil> viil;

#define pb push_back
#define mp make_pair
#define rep(i, n) for (int i = 0 ; i < n ; i++)
#define INF 1000000000

vi adj[200005];
vi bb;
vi cc;
bool vis[200005];
int n;
ii rng[200005];
int a[200005];
int s[200005];
int ds[200005];
int f[200005];

int rangeMin(int a, int b) {
    if (a == b) {
        return bb[a];
    }
    a += n;
    b += n;
    int sm = 1000000000;
    while (a <= b) {
        if (a % 2 == 1) {
            sm = min(sm, s[a]);
            a++;
        }
        if (b % 2 == 0) {
            sm = min(sm, s[b]);
            b--;
        }
        a /= 2;
        b /= 2;
    }
    return sm;
}

void dfs(int n, int d) {

    vis[n] = true;
    ds[n] = d;
    bb.push_back(ds[n]);
    cc.push_back(n);
    bool f = false;
    for (int a : adj[n]) {
        if (vis[a]) {
            continue;
        }
        f = true;
        dfs(a, d + 1);
        bb.push_back(ds[n]);
        cc.push_back(n);
    }
    //if (f) {
        //bb.push_back(n);
    //}
}

int dst(int a, int b) {
    int x = f[a];
    int y = f[b];
    int ans;
    if (x <= y) {
        ans = rangeMin(f[a], f[b]);
    }
    else {
        ans = rangeMin(f[b], f[a]);
    }

    return ds[a] + ds[b] - ans * 2;
}

void solve() {
    memset(vis, false, sizeof vis);
    cin >> n;
    rep(i, n - 1) {
        int aa, bbb;
        cin >> aa >> bbb;
        aa--; bbb--;
        adj[aa].pb(bbb);
        adj[bbb].pb(aa);
    }

    dfs(0, 0);
    n = 0;
    for (int i = cc.size() - 1 ; i >= 0 ; i--) {
        a[i] = bb[i];
        f[cc[i]] = i;
        n++;
    }

    while (abs((int)(log(n)/log(2)) != (log(n)/log(2)))) {
        n++;
        a[n - 1] = 0;
    }

    int p = (int)(log(n)/log(2));
    int pp = pow(2, p);

    memset(s, 0, sizeof s);
    for (int i = 0 ; i < n * 2 ; i++) {
        s[i] = 1000000000;
    }

    for (int i = 0 ; i < n ; i++) {
        int ind = pp + i;
        s[ind] = min(s[ind], a[i]);
        while (ind > 0) {
            ind /= 2;
            s[ind] = min(s[ind], a[i]);
        }
    }

    int q;
    cin >> q;
    cout << endl;
    rep(i, q) {
        int x, y, a, b, k; cin >> x >> y >> a >> b >> k;

        x--; y--; a--; b--;
        int d1 = dst(a, b);
        int d2 = dst(a, x) + dst(b, y) + 1;
        int d3 = dst(a, y) + dst(b, x) + 1;
        int dss[3] = {d1, d2, d3};
        bool f = false;
        for (int e : dss) {
            //cout << e << endl;
            if (e <= k && e % 2 == k % 2) {
                f = true;
            }
        }

        if (f) {
            cout << "YES" << '\n';
        }
        else {
            cout << "NO" << '\n';
        }
    }
}

void querySolve() {
    int n;
    cin >> n;
    while (n--) {
        solve();
    }
}

int main() {
    //querySolve();
    solve();
}