#include <bits/stdc++.h>
using namespace std;
int n, m, counts[20];
string in[20], lhs, rhs, temp;
map<string, int> hs;
vector<int> ps[20];
int main() {
  int i, j;
  cin >> n >> m;
  for ((i) = 0; (i) < (int)n; (i)++) {
    cin >> in[i];
    hs.insert(make_pair(in[i], i));
  }
  for ((i) = 0; (i) < (int)m; (i)++) {
    cin >> lhs >> rhs;
    ps[hs[lhs]].push_back(hs[rhs]);
    ps[hs[rhs]].push_back(hs[lhs]);
  }
  int res = 0;
  int resCount = 0;
  for (int S = 0; S < (1 << n); S++) {
    bool ok = true;
    for ((i) = 0; (i) < (int)n; (i)++)
      if ((1 << i) & S) {
        int psz = ps[i].size();
        for ((j) = 0; (j) < (int)psz; (j)++)
          if ((1 << ps[i][j]) & S) {
            ok = false;
            i = n;
            j = psz;
          }
      }
    if (!ok) continue;
    int tempCount = 0;
    for ((i) = 0; (i) < (int)n; (i)++)
      if ((1 << i) & S) tempCount++;
    if (resCount < tempCount) {
      resCount = tempCount;
      res = S;
    }
  }
  vector<string> ans;
  for ((i) = 0; (i) < (int)n; (i)++)
    if ((1 << i) & res) ans.push_back(in[i]);
  sort(ans.begin(), ans.end());
  cout << ans.size() << endl;
  int asz = ans.size();
  for ((i) = 0; (i) < (int)asz; (i)++) {
    cout << ans[i] << endl;
  }
  return 0;
}
