#include <bits/stdc++.h>
using namespace std;
const int N = 16 + 5;
string a[N], x, y;
int n, m, M = -1;
map<string, map<string, int> > mm;
bool vis[N];
void dfs(int deep, int mod) {
  if (deep > n + 1) return;
  if (deep == n + 1) {
    int tot = 0, f = 1;
    for (int i = 1; i <= n; ++i) tot += vis[i];
    for (int i = 1; i <= n; ++i)
      for (int j = i + 1; j <= n; ++j)
        if (vis[i] && vis[j])
          if (mm[a[i]][a[j]]) {
            f = 0;
            break;
          }
    if (f) {
      if (mod) {
        int tot = 0;
        for (int i = 1; i <= n; ++i) tot += vis[i];
        if (tot != M) return;
        printf("%d\n", M);
        string res[N];
        for (int i = 1; i <= 17; ++i) res[i] = "0";
        int pos = 1;
        for (int i = 1; i <= n; ++i)
          if (vis[i]) res[pos++] = a[i];
        sort(res + 1, res + pos);
        pos = 1;
        while (res[pos] != "0") {
          cout << res[pos] << endl;
          pos++;
        }
        exit(0);
      } else if (mod == 0)
        M = max(M, tot);
    }
  }
  vis[deep] = true;
  dfs(deep + 1, mod);
  vis[deep] = false;
  dfs(deep + 1, mod);
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; ++i) cin >> a[i];
  for (int i = 1; i <= m; ++i) {
    cin >> x >> y;
    mm[x][y] = mm[y][x] = 1;
  }
  dfs(1, 0);
  dfs(1, 1);
  return 0;
}
