#include <bits/stdc++.h>
using namespace std;
const int maxn = 5e4 + 10;
int N, R1, R2, P[maxn];
vector<int> adj[maxn];
void DFS(int u) {
  for (int i = int(0); i <= int(adj[u].size() - 1); i++) {
    int v = adj[u][i];
    if (P[v]) continue;
    P[v] = u;
    DFS(v);
  }
}
int main() {
  scanf("%d%d%d\n", &N, &R1, &R2);
  for (int i = 1, u; i <= N - 1 && scanf("%d", &u); i++) {
    int v = (i < R1) ? i : i + 1;
    adj[u].push_back(v);
    ;
    adj[v].push_back(u);
    ;
  }
  P[R2] = -1;
  DFS(R2);
  for (int i = int(1); i <= int(N); i++)
    if (i != R2) printf("%d ", P[i]);
}
