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