#include <bits/stdc++.h>
using namespace std;
const int N = 17;
int a[N][N], n, m, best, bestn;
string s, t, S[N];
char buff[20];
map<string, int> M;
vector<string> ans;
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 0; i < n; i++) {
    scanf("%s", buff);
    s = buff;
    M[s] = i;
    S[i] = s;
  }
  for (int i = 0; i < m; i++) {
    scanf("%s", buff);
    s = buff;
    scanf("%s", buff);
    t = buff;
    a[M[s]][M[t]] = a[M[t]][M[s]] = 1;
  }
  for (int i = 0; i < (1 << n); i++) {
    bool bad = 0;
    int num = 0;
    for (int j = 0; j < n; j++)
      if (i & (1 << j)) {
        for (int k = 0; k < n; k++)
          if (i & (1 << k)) bad |= a[j][k];
        num++;
      }
    if (!bad && num > bestn) best = i, bestn = num;
  }
  for (int i = 0; i < n; i++)
    if (best & (1 << i)) ans.push_back(S[i]);
  sort(ans.begin(), ans.end());
  printf("%d\n", (int)ans.size());
  for (int i = 0; i < (int)ans.size(); i++) printf("%s\n", ans[i].c_str());
  return 0;
}
