#include <bits/stdc++.h>
using namespace std;
string s[20], s0, s1, ans[20];
int g[20][20], ANS, n, tp[20];
void dfs(int now, int end, int cnt) {
  if (now == end) {
    for (int i = 0; i < cnt; i++)
      for (int j = i + 1; j < cnt; j++)
        if (g[tp[i]][tp[j]]) return;
    if (cnt > ANS) {
      ANS = cnt;
      for (int i = 0; i < cnt; i++) ans[i] = s[tp[i]];
    }
    return;
  }
  tp[cnt] = now;
  dfs(now + 1, end, cnt + 1);
  dfs(now + 1, end, cnt);
}
int find(string x) {
  for (int i = 0; i < n - 1; i++)
    if (x == s[i]) return i;
  return n - 1;
}
int main() {
  int m;
  while (scanf("%d%d", &n, &m) == 2) {
    for (int i = 0; i < n; i++) cin >> s[i];
    memset(g, 0, sizeof(g));
    for (int i = 0; i < m; i++) {
      cin >> s0 >> s1;
      int id1 = find(s0);
      int id2 = find(s1);
      g[id1][id2] = g[id2][id1] = 1;
    }
    ANS = 0;
    dfs(0, n, 0);
    printf("%d\n", ANS);
    sort(ans, ans + ANS);
    for (int i = 0; i < ANS; i++) printf("%s\n", ans[i].c_str());
  }
  return 0;
}
