while True: s=raw_input("") if s=="0 0 0": break c=s.split(" ") for i in range(0,len(c[0])): if c[0][i]==c[1]: c[0][i]=c[2] print c[0]