#include <bits/stdc++.h>
using namespace std;
char s[20][15];
bool road[20][20];
int dp[100000];
char shuchu[20][15];
int comp(const void *_a, const void *_b) {
  char *a = (char *)_a;
  char *b = (char *)_b;
  return strcmp(a, b);
}
int jisuan(int x) {
  int queue[25];
  int cnt = 1;
  int step = 1;
  while (x) {
    if (x & 1) {
      queue[cnt++] = step;
    }
    step++;
    x >>= 1;
  }
  int i, j;
  int flag = 0;
  for (i = 1; i < cnt; i++) {
    for (j = 1; j < cnt; j++) {
      if (i == j) continue;
      if (road[queue[i]][queue[j]]) {
        flag = 1;
        break;
      }
    }
  }
  if (flag)
    return -1;
  else
    return cnt - 1;
}
int main() {
  int n, m;
  while (scanf("%d%d", &n, &m) != EOF) {
    memset(road, false, sizeof(road));
    int i;
    for (i = 1; i <= n; i++) {
      scanf("%s", s[i]);
    }
    char s1[15], s2[15];
    int j;
    int k;
    int l;
    for (j = 1; j <= m; j++) {
      scanf("%s%s", s1, s2);
      for (k = 1; k <= n; k++) {
        if (strcmp(s1, s[k]) == 0) break;
      }
      for (l = 1; l <= n; l++) {
        if (strcmp(s2, s[l]) == 0) break;
      }
      road[k][l] = road[l][k] = true;
    }
    int max = 0;
    int maxnum = 0;
    for (i = 0; i < (1 << n); i++) {
      int q = jisuan(i);
      if (q > max) {
        max = q;
        maxnum = i;
      }
    }
    int bu = 1;
    printf("%d\n", max);
    int ll = 0;
    while (maxnum) {
      if (maxnum & 1) {
        strcpy(shuchu[ll++], s[bu]);
      }
      bu++;
      maxnum >>= 1;
    }
    qsort(shuchu, max, sizeof(shuchu[0]), comp);
    for (i = 0; i < max; i++) {
      printf("%s\n", shuchu[i]);
    }
  }
  return 0;
}
