#include <bits/stdc++.h>
char name[16][13], *nx[16];
bool map[16][16], pick[17];
int n, m, max, tm, p;
inline int getid(char *na) {
  int i;
  for (i = 0; i < n; ++i) {
    if (!strcmp(na, name[i])) return i;
  }
}
int cal(int st) {
  int i, j, tn = 0;
  for (i = 0; i < n; ++i) {
    if (st & 1)
      pick[i] = 1, ++tn;
    else
      pick[i] = 0;
    st = st >> 1;
  }
  if (tn < max) return -1;
  for (i = 0; i < n; ++i) {
    if (!pick[i]) continue;
    for (j = i + 1; j < n; ++j) {
      if (pick[j] && map[i][j]) return -1;
    }
  }
  return tn;
}
int cmp(const void *a, const void *b) {
  return strcmp(*((char **)a), *((char **)b));
}
int main() {
  int i, j, ai, bi, n2;
  char a[13], b[13];
  scanf("%d%d", &n, &m);
  for (n2 = 1, i = 0; i < n; ++i) n2 *= 2;
  for (i = 0; i < n; ++i) scanf("%s", name[i]);
  for (i = 0; i < n; ++i) {
    for (j = 0; j < n; ++j) map[i][j] = 0;
  }
  for (i = 0; i < m; ++i) {
    scanf("%s%s", a, b);
    ai = getid(a);
    bi = getid(b);
    map[ai][bi] = 1;
    map[bi][ai] = 1;
  }
  p = 0;
  max = 0;
  for (i = 1; i < n2; ++i) {
    tm = cal(i);
    if (max < tm) {
      max = tm;
      p = i;
    }
  }
  for (i = 0; i < n; ++i) {
    if (p & 1)
      pick[i] = 1;
    else
      pick[i] = 0;
    p = p >> 1;
  }
  for (i = 0, j = 0; i < n; ++i) {
    if (pick[i]) nx[j++] = name[i];
  }
  qsort(nx, j, sizeof(char *), cmp);
  printf("%d\n", max);
  for (i = 0; i < max; ++i) printf("%s\n", nx[i]);
  return 0;
}
