#include <bits/stdc++.h>   using namespace std;   int dx[] = {1, -1, 0, 0}, dy[] = {0, 0, 1, -1};   const int N = 500005;   vector<int> arr[N], cnt[N], adj[N];   int vis[N], st[N], fin[N], dep[N];   int tim;   char inp[N];   void dfs(int i, int d) {     vis[i] = 1;     dep[i] = d;     st[i] = ++tim;     arr[d].push_back(st[i]);     int no = 0;     for (int first = 0; first < (int)26; first++)       no |= (first == inp[i] -  a ) << first;     cnt[d].push_back(no);     for (int v : adj[i])       if (!vis[v]) dfs(v, d + 1);     fin[i] = ++tim;   }   signed main() {     ios::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     int n, m;     cin >> n >> m;     for (int i = 0; i < (int)n - 1; i++) {       int first;       cin >> first;       adj[first].push_back(i + 2);       adj[i + 2].push_back(first);     }     for (int i = 0; i < (int)n; i++) cin >> inp[i + 1];     dfs(1, 0);     for (int i = 0; i < (int)N; i++) {       for (int j = 1; j < cnt[i].size(); j++) {         cnt[i][j] ^= cnt[i][j - 1];       }     }     for (int wrd = 0; wrd < (int)m; wrd++) {       int a, b;       cin >> a >> b;       b--;       int no_odds = 0;       vector<int>& v = arr[b];       int l = lower_bound((v).begin(), (v).end(), st[a]) - v.begin();       int r = upper_bound((v).begin(), (v).end(), fin[a]) - v.begin() - 1;       if (l > r) {         cout <<  Yes n ;         continue;       }       for (int first = 0; first < (int)26; first++) {         int add = (cnt[b][r] >> first) & 1;         int sub = (l == 0) ? 0 : ((cnt[b][l - 1] >> first) & 1);         no_odds += (add - sub + 2) % 2;       }       if (no_odds <= 1)         cout <<  Yes n ;       else         cout <<  No n ;     }   }   