#include<cstdio> #include<cstdlib> #include<cstring> #include<cmath> #include<iostream> #include<algorithm> using namespace std; #define N 100 char a[N][N]; char b[N][N], low_b[N][N]; int ans[N]; int cnt = 0; int main() { int n,m; while(~scanf("%d%d", &n, &m)) { cnt++; getchar(); memset(ans, 0, sizeof(ans)); for(int i = 0; i < n; i++) scanf("%s", a[i]); getchar(); for(int i = 0; i < m; i++) gets(b[i]); for(int i = 0; i < m; i++) for(int j = 0; j < strlen(b[i]); j++) low_b[i][j] = tolower(b[i][j]); for(int i = 0; i < m; i++) { int s = -2, e = -2; if(isalpha(low_b[i][0])) s=-1; int len = strlen(low_b[i]); for(int j = 0; j < len; j++) { if(!isalpha(low_b[i][j])) { if(s!=-2&&isalpha(low_b[i][j-1])) { e=j; char tmp[N]; int k; for(k = s+1; k < e; k++) tmp[k-s-1] = low_b[i][k]; tmp[e-s-1] = '\0'; //printf("%s\n", tmp); for(k = 0; k < n; k++) if(strcmp(a[k], tmp)==0) ans[i]++; s = -2; e = -2; } if(s==-2&&isalpha(low_b[i][j+1])) s = j; } } } int Max = 0; for(int i = 0; i < m; i++) Max = max(Max, ans[i]); // for(int i = 0; i < m; i++) // printf("%d\n", ans[i]); printf("Excuse Set #%d\n", cnt); for(int i = 0; i < m; i++) if(Max==ans[i]) printf("%s\n", b[i]); printf("\n"); } return 0; }