#include <bits/stdc++.h>
using namespace std;
int n, r1, r2, res[55555];
bool vis[55555];
vector<int> g[55555];
void dfs(int u, int p) {
  vis[u] = true, res[u] = p;
  for (int i = 0, _a = (((int)g[u].size())); i < _a; ++i) {
    int v = g[u][i];
    if (!vis[v]) dfs(v, u);
  }
}
int main() {
  scanf("%d%d%d", &n, &r1, &r2);
  for (int i = (1), _b = (n - 1); i <= _b; ++i) {
    int p;
    scanf("%d", &p);
    if (i >= r1)
      g[i + 1].push_back(p), g[p].push_back(i + 1);
    else
      g[i].push_back(p), g[p].push_back(i);
  }
  dfs(r2, r2);
  for (int i = (1), _b = (n); i <= _b; ++i)
    if (i != r2) printf("%d ", res[i]);
  return 0;
}
