#include <bits/stdc++.h>   using namespace std;   template <class T>   bool umin(T& a, T b) {     if (a > b) {       a = b;       return 1;     }     return 0;   }   template <class T>   bool umax(T& a, T b) {     if (a < b) {       a = b;       return 1;     }     return 0;   }   vector<int> b[200009], r[200009];   vector<pair<int, int> > upd[200009][2];   vector<int> last, now;   int blue[200009], red[200009], type = 1, TIM, vis[200009][2];   int bin[200009], bout[200009], rin[200009], rout[200009];   void dfsB(int nd, int pr) {     bin[nd] = ++TIM;     for (int i = 0; i < int(b[nd].size()); i++) {       int to = b[nd][i];       if (to == pr) continue;       dfsB(to, nd);     }     bout[nd] = TIM;   }   void dfsR(int nd, int pr) {     rin[nd] = ++TIM;     for (int i = 0; i < int(r[nd].size()); i++) {       int to = r[nd][i];       if (to == pr) continue;       dfsR(to, nd);     }     rout[nd] = TIM;   }   struct Two_Rooted_Tree {     vector<pair<int, int> > s[200009 << 2];     int st[200009 << 2], en[200009 << 2];     void merge(int nd) {       int p1 = 0, p2 = 0;       int s1 = s[nd << 1].size();       int s2 = s[nd << 1 | 1].size();       st[nd] = 0;       en[nd] = s1 + s2 - 1;       while (p1 + p2 < s1 + s2) {         if (p1 >= s1)           s[nd].push_back(s[nd << 1 | 1][p2++]);         else if (p2 >= s2)           s[nd].push_back(s[nd << 1][p1++]);         else if (s[nd << 1][p1] <= s[nd << 1 | 1][p2])           s[nd].push_back(s[nd << 1][p1++]);         else           s[nd].push_back(s[nd << 1 | 1][p2++]);       }     }     void build(int tp, int nd, int x, int y) {       s[nd].clear();       if (x == y) {         st[nd] = 0;         en[nd] = -1;         for (__typeof((upd[x][tp]).begin()) it = (upd[x][tp]).begin();              it != (upd[x][tp]).end(); it++) {           s[nd].push_back(*it);           en[nd]++;         }         sort(s[nd].begin(), s[nd].end());         return;       }       int mid = (x + y) >> 1;       build(tp, nd << 1, x, mid);       build(tp, nd << 1 | 1, mid + 1, y);       merge(nd);     }     void tap(int l, int r, int nd, int x, int y) {       if (l > y or x > r) return;       if (l <= x and y <= r) {         while (st[nd] <= en[nd] and s[nd][st[nd]].first < l) {           if (!vis[s[nd][st[nd]].second][type]) {             vis[s[nd][st[nd]].second][type] = 1;             now.push_back(s[nd][st[nd]].second);           }           st[nd]++;         }         while (st[nd] <= en[nd] and s[nd][en[nd]].first > r) {           if (!vis[s[nd][en[nd]].second][type]) {             vis[s[nd][en[nd]].second][type] = 1;             now.push_back(s[nd][en[nd]].second);           }           en[nd]--;         }         return;       }       int mid = (x + y) >> 1;       tap(l, r, nd << 1, x, mid);       tap(l, r, nd << 1 | 1, mid + 1, y);     }   } B, R;   int main() {     int n;     scanf( %d , &n);     for (int i = 1; i < n; i++) {       scanf( %d , blue + i);       b[i + 1].push_back(blue[i]);       b[blue[i]].push_back(i + 1);     }     for (int i = 1; i < n; i++) {       scanf( %d , red + i);       r[i + 1].push_back(red[i]);       r[red[i]].push_back(i + 1);     }     dfsB(1, -1);     TIM = 0;     dfsR(1, -1);     TIM = 0;     for (int i = 1; i <= n; i++) {       int u = i + 1;       int v = blue[i];       upd[rin[u]][1].push_back(make_pair(rin[v], i));       upd[rin[v]][1].push_back(make_pair(rin[u], i));     }     for (int i = 1; i <= n; i++) {       int u = i + 1;       int v = red[i];       upd[bin[u]][0].push_back(make_pair(bin[v], i));       upd[bin[v]][0].push_back(make_pair(bin[u], i));     }     B.build(0, 1, 1, n);     R.build(1, 1, 1, n);     int ind;     scanf( %d , &ind);     last.push_back(ind);     vis[ind][0] = 1;     printf( Blue n%d n , ind);     while (1) {       for (int i = 0; i < int(last.size()); i++) {         if (type) {           int u = blue[last[i]];           int v = last[i] + 1;           if (bin[v] <= bin[u] and bout[u] <= bout[v]) swap(u, v);           if (bin[u] <= bin[v] and bout[v] <= bout[u])             B.tap(bin[v], bout[v], 1, 1, n);         } else {           int u = red[last[i]];           int v = last[i] + 1;           if (rin[v] <= rin[u] and rout[u] <= rout[v]) swap(u, v);           if (rin[u] <= rin[v] and rout[v] <= rout[u])             R.tap(rin[v], rout[v], 1, 1, n);         }       }       if (now.size() == 0) break;       sort(now.begin(), now.end());       if (type)         printf( Red n );       else         printf( Blue n );       type = (1 - type);       for (__typeof((now).begin()) it = (now).begin(); it != (now).end(); it++)         printf( %d  , *it);       puts(  );       swap(last, now);       now.clear();     }     return 0;   }