while 1: q=" ";a,b=raw_input().split(q,1) for c in b+q:a=a.replace(c,q);q=c print a