w = input() n1, n2 = [int(_) for _ in input().split()] w1 = w.index(n1) w2 = w.index(n2) w0 = list(w) w0[n1] = w2 w0[n2] = w1 print(*w0)