a,b='*-' S=[input()for x in a*int(input().split()[0])] for i in S: c=a in i if[c,c<1][sum(a in x for x in S)<2]:i=i.replace(b,a,1);b=a print(i)