import java.math.*;
import java.util.*;
import java.io.*;
 
public class scanword_aa_java implements Runnable {
 
    public BufferedReader in;
    public StringTokenizer stoken = new StringTokenizer("");
    public PrintWriter out;
 
    public static void main(String[] args) throws IOException {
      new Thread(null, new scanword_aa_java(), "", (1 << 25)).start();
    }   
        
    public void run() {
      try {
        in = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        solve();
        } catch (Exception e) {
        throw new RuntimeException(e);
      } finally {
        out.close();
      }
    }
    
      int[][] a = new int[1010][30];
        
        private void solve() throws IOException{
            int m = nextInt(), n = nextInt();
            for (int i = 0; i < n; i++)
              for (int j = 0; j < 26; j++)
                a[i][j] = 0;
            for (int i = 0; i < n; i++) {
              String s = nextLine();
              for (int j = 0; j < m; j++) {
                char ch = s.charAt(j);
                if (ch >= 'A' && ch <= 'Z') ch += 32;
                if (ch >= 'a' && ch <= 'z') a[j][(int)ch - 97]++;
              }
            }
            for (int i = 0; i < m; i++) {
              int mx = 0;
              for (int j = 1; j < 26; j++)
                if (a[i][j] > a[i][mx]) mx = j;
              out.print((char)(mx + 97));
            }
        }
     
        private int nextInt() throws NumberFormatException, IOException {
            return Integer.parseInt(nextString());
        }
     
        private long nextLong() throws NumberFormatException, IOException {
            return Long.parseLong(nextString());
        }
     
        private String nextString() throws IOException {
            while(!stoken.hasMoreTokens()){
                String st = in.readLine();
                stoken = new StringTokenizer(st);
            }
            return stoken.nextToken();
        }
     
        private String nextLine() throws IOException {
            return in.readLine();
        }
     
    }  