34_D. Road Map
There are n cities in Berland. Each city has its index — an integer number from 1 to n. The capital has index r1. All the roads in Berland are two-way. The road system is such that there is exactly one path from the capital to each city, i.e. the road map looks like a tree. In Berland's chronicles the road map is kept in the following way: for each city i, different from the capital, there is kept number pi — index of the last city on the way from the capital to i.

Once the king of Berland Berl XXXIV decided to move the capital from city r1 to city r2. Naturally, after this the old representation of the road map in Berland's chronicles became incorrect. Please, help the king find out a new representation of the road map in the way described above.

Input

The first line contains three space-separated integers n, r1, r2 (2 ≤ n ≤ 5·104, 1 ≤ r1 ≠ r2 ≤ n) — amount of cities in Berland, index of the old capital and index of the new one, correspondingly.

The following line contains n - 1 space-separated integers — the old representation of the road map. For each city, apart from r1, there is given integer pi — index of the last city on the way from the capital to city i. All the cities are described in order of increasing indexes.

Output

Output n - 1 numbers — new representation of the road map in the same format.

Examples

Input

3 2 3
2 2


Output

2 3 

Input

6 2 4
6 1 2 4 2


Output

6 4 1 4 2 
```python
import sys

sys.setrecursionlimit(100000)

n, r1, r2 = map(int, input().split())
a = list(map(int, input().split()))
g = {}
num = 0

for k, v in enumerate(a):
    num += 1
    if num == r1:
        num += 1
    # print(k, num, v)
    if num not in g:
        g[num] = []
    g[num].append(v)
    if v not in g:
        g[v] = []
    g[v].append(num)

# print(g)

b = [0] * (n + 1)
visited = set()


def visit(cur, parent):
    visited.add(cur)
    b[cur] = parent
    for child in g[cur]:
        if child not in visited:
            visit(child, cur)


from collections import deque

q = deque()
q.append((r2, 0))

while q:
    cur, parent = q.popleft()
    if cur not in visited:
        visited.add(cur)
        b[cur] = parent
        for child in g[cur]:
            q.append((child, cur))

b2 = [b[k] for k in range(n + 1) if k > 0 and k != r2]
# print(b)
print(*b2)

"""
#
"""

# from random import randint
#
# a = [1, 3, 2, 4, 5, 100, 6, 8, 9, 13, 19, 34, 10, 23, 65, 40, 63, 45, 16, 97, 30, 17, 7, 67, 82, 11, 81, 22, 61, 57, 41, 66, 73, 52, 50, 15, 58, 72, 53, 88, 87, 93, 56, 98, 29, 76, 26, 99, 85, 42, 33, 18, 49, 83, 71, 14, 46, 20, 70, 86, 25, 74, 27, 94, 28, 0, 80, 92]
# # for k in range(100):
# #     a.append(randint(0, 100))
#
# d = {}
# b = []
# for k, v in enumerate(a):
#     new = False
#     if v not in d:
#         d[v] = 0
#         new = True
#
#     last = 0
#     for p in range(len(b) - 1, -1, -1):
#         val = b[p]
#         if last < val <= v:
#             if val > d[v]:
#                 d[v] = val
#             last = val
#     if new:
#         b.append(v)
#
# print(len(b))
#
# # b = []
# # ar = []
# #
# # for k, v in enumerate(a):
# #     lb = len(b)
# #     last = 0
# #     for k2 in range(lb):
# #         arr = b[k2]
# #         val = arr[-1]
# #         if last < val <= v:
# #             arr2 = arr[::]
# #             arr.append(v)
# #             b.append(arr2)
# #             last = val
# #             if len(arr) > len(ar):
# #                 ar = arr
# #
# #     if len(b) == lb:
# #         b.append([v])
# #
# # print(len(b))
# # b.sort(key=lambda x: len(x))
# # for row in b:
# #     print(row)
# # print('--')
# # print(ar)
#
# # def var(s, c):
# #     if c == 0:
# #         for k in range(10):
# #             s1 = str(s) + str(k)
# #             print(s1)
# #     else:
# #         for k in range(10):
# #             s1 = str(s) + str(k)
# #             var(s1, c - 1)
# #
# #
# # def var0():
# #     for k in range(10):
# #         var(k, 3)
# #
# #
# # var0()

```