func_code_string: #include <bits/stdc++.h>   #pragma comment(linker,  /STACK:1024000000,1024000000 )   using namespace std;   const int maxn = 510005;   int n, m;   vector<int> g[maxn];   char s[maxn];   vector<int> dep[maxn];   vector<int> op[maxn];   int id[maxn][2];   int deep[maxn];   int mx[maxn];   int dfs_clock = 1;   void dfs(int u, int d) {     deep[u] = mx[u] = d;     id[u][0] = dfs_clock++;     dep[d].push_back(1 << (s[u] -  a ));     op[d].push_back(id[u][0]);     for (int i = 0; i < g[u].size(); i++) {       dfs(g[u][i], d + 1);       mx[u] = max(mx[u], mx[g[u][i]]);     }     id[u][1] = dfs_clock++;   }   int main() {     int p;     scanf( %d%d , &n, &m);     for (int i = 2; i <= n; i++) {       scanf( %d , &p);       g[p].push_back(i);     }     scanf( %s , s + 1);     dfs(1, 1);     for (int i = 1; i <= n; i++) {       for (int j = 1; j < dep[i].size(); j++) {         dep[i][j] ^= dep[i][j - 1];       }     }     int u, h;     for (int i = 0; i < m; i++) {       scanf( %d%d , &u, &h);       if (h <= deep[u] || h > mx[u]) {         printf( Yes n );       } else {         int i = upper_bound(op[h].begin(), op[h].end(), id[u][0]) - op[h].begin();         int j =             upper_bound(op[h].begin(), op[h].end(), id[u][1]) - op[h].begin() - 1;         int a;         if (i - 1 >= 0)           a = dep[h][j] ^ dep[h][i - 1];         else           a = dep[h][j];         int num = 0;         for (int i = 0; i < 26; i++) {           if (a & (1 << i)) num++;         }         if (num <= 1)           printf( Yes n );         else           printf( No n );       }     }     return 0;   }   