#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define MAX_STRING 1000
#define MAX_COMM 62
char common[MAX_COMM];
void Harsh(char *q, int *p, int n);
void endHarsh();
int main () {
int table[150];
int n,m;
char arr[MAX_STRING];
scanf("%d",&n);
scanf("%d",&m);
for(int i=0;i<m;i++){
scanf("%s",arr);
char *q = arr;
int *p = table;
for(int i = 0 ; i < 150 ; i++) table[i] = 0;
Harsh(q,p,n);
}
for(int i = 0 ; i < 150 ; i++) table[i] = 0;
char *a = common;
endHarsh(a,table,m);
return 0;
}
void Harsh(char *q, int *p, int n){
int key;
while (*q){
key = *q;
p[key]++;
q++;
}
char *comm;
comm = (char*)malloc(sizeof(char)*MAX_COMM);
int j=0;
for(int i = 0 ; i < 150 ; i++){
if(p[i]>=n){
comm[j] = i;
j++;
}
}
memcpy(common+strlen(common),comm,strlen(comm));
free(comm);
}
void endHarsh(char *a,int *table,int m){
int key;
while (*a){
key = *a;
table[key]++;
a++;
}
char *comm;
comm = (char*)malloc(sizeof(char)*MAX_COMM);
int j=0;
for(int i = 0 ; i < 150 ; i++){
if(table[i]>=m){
comm[j] = i;
j++;
}
}
printf("[");
for(int i = 0 ; i < j ; i++){
if(i<(j-1)) printf("%c ",comm[i]);
else printf("%c",comm[i]);
}
printf("]");
free(comm);
}