var
	i, j, n, m : longint;
	a : array[0..1010, 'A'..'Z'] of longint;
	xx, ch : char;

begin
	readln(m, n);
	fillchar(a, sizeof(a), 0);
	for i := 1 to n do begin
		for j := 1 to m do begin
			read(ch);
			ch := UpCase(ch);
			if ch in ['A'..'Z'] then inc(a[j][ch]);
		end;
		readln;
	end;
	for i := 1 to m do begin
		xx := 'A';
		for ch := 'B' to 'Z' do
			if a[i][ch] > a[i][xx] then xx := ch;
		write(xx);
	end;
end.
