#include <vector>
#include <iostream>
#include <string>
using namespace std;
int GetMin(vector<int> vec)
{
int minSer = 0;
for (int i = 0; i < 4; i++)
{
if (vec[i] < vec[minSer])
{
swap(vec[i], vec[minSer]);
minSer = i;
}
}
return minSer;
}
int main()
{
int m,n;
cin >> m>>n;
vector<string> all_DNA(m);
for (int i = 0; i < m; i++)
cin >> all_DNA[i];
string word = "ACGT";
string result;
for (int k = 0; k < n; k++)
{
vector<int> Ham(4);
for (int i = 0; i < 4; i++)
for (int j = 0; j < m; j++)
Ham[i] += (word[i] != all_DNA[j][k]);
result.push_back(word[GetMin(Ham)]);
}
cout <<result << endl;
return 0;
}
DNA序列只包含ACGT,分别求出每一列距离最小的字母