func_code_string: #include <bits/stdc++.h>   using namespace std;   const int N = 1e5 + 100;   int h[N], nex[N << 1], to[N << 1], tot, dis[N];   void add(int x, int y) {     to[++tot] = y;     nex[tot] = h[x];     h[x] = tot;   }   int fa[N][30], dep[N], lg[N];   void dfs(int u, int fath, int d) {     dis[u] = d;     fa[u][0] = fath;     dep[u] = dep[fath] + 1;     for (int i = 1; i <= lg[dep[u]]; i++) fa[u][i] = fa[fa[u][i - 1]][i - 1];     for (int j = h[u]; j; j = nex[j])       if (to[j] != fath) dfs(to[j], u, d + 1);   }   int lca(int x, int y) {     if (dep[x] < dep[y]) swap(x, y);     while (dep[x] > dep[y]) x = fa[x][lg[dep[x] - dep[y]] - 1];     if (x == y) return x;     for (int i = lg[dep[x] - 1]; i >= 0; i--)       if (fa[x][i] != fa[y][i]) x = fa[x][i], y = fa[y][i];     return fa[x][0];   }   int main() {     int n;     scanf( %d , &n);     for (int i = 1; i < n; i++) {       int u, v;       scanf( %d%d , &u, &v);       add(u, v);       add(v, u);     }     for (int i = 1; i <= n; i++) lg[i] = lg[i - 1] + (1 << lg[i - 1] == i);     dfs(1, 0, 0);     int q;     scanf( %d , &q);     for (int i = 1; i <= q; i++) {       int x, y, a, b, k;       scanf( %d%d%d%d%d , &x, &y, &a, &b, &k);       int lcab = lca(a, b);       int d1 = dis[a] + dis[b] - 2 * dis[lcab];       if (k >= d1 && (k % 2) == (d1 % 2)) {         printf( Yes n );         continue;       }       int lcax = lca(a, x);       int lcay = lca(a, y);       int lcby = lca(b, y);       int lcbx = lca(b, x);       int d2 = dis[x] + dis[a] - 2 * dis[lcax];       int d3 = dis[a] + dis[y] - 2 * dis[lcay];       int d4 = dis[b] + dis[y] - 2 * dis[lcby];       int d5 = dis[b] + dis[x] - 2 * dis[lcbx];       if (k >= (d2 + 1 + d4) && (k % 2) == ((d2 + 1 + d4) % 2)) {         printf( Yes n );       } else if (k >= (d3 + 1 + d5) && (k % 2) == ((d3 + 1 + d5) % 2)) {         printf( Yes n );       } else {         printf( No n );       }     }     return 0;   }   