#include <bits/stdc++.h>
using namespace std;
int main() {
  int g[16][16];
  vector<string> vs;
  map<string, int> m;
  int n, mm;
  memset(g, 0, sizeof(g));
  scanf("%d %d", &n, &mm);
  for (int i = 0; i < n; i++) {
    char name[20];
    scanf("%s", name);
    m.insert(make_pair(name, i));
    vs.push_back(name);
  }
  for (int i = 0; i < mm; i++) {
    char name1[20], name2[20];
    scanf("%s %s", name1, name2);
    int a = m[name1], b = m[name2];
    g[a][b] = 1;
  }
  int res = 0;
  vector<int> res_v;
  for (int i = 0; i < 1 << n; i++) {
    int cnt = 0;
    vector<int> v;
    for (int j = 0; j < n; j++)
      if ((i >> j) & 1) {
        cnt++;
        v.push_back(j);
      }
    bool flag = true;
    for (int j = 0; j < v.size(); j++)
      for (int k = 0; k < v.size(); k++)
        if (g[v[j]][v[k]] == 1) flag = false;
    if (flag && cnt > res) {
      res = cnt;
      res_v = v;
    }
  }
  vector<string> rv;
  for (int i = 0; i < res_v.size(); i++) rv.push_back(vs[res_v[i]]);
  sort(rv.begin(), rv.end());
  printf("%d\n", res);
  for (int i = 0; i < rv.size(); i++) printf("%s\n", rv[i].c_str());
  return 0;
}
