#include <bits/stdc++.h>
using namespace std;
void run() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL), cout.tie(NULL);
}
map<string, int> m;
bool vis[20][20];
int main() {
  run();
  int n, k;
  cin >> n >> k;
  vector<string> name;
  vector<int> ans;
  for (int i = 0; i < (int)(n); ++i) {
    string s;
    cin >> s;
    name.push_back(s);
    m[s] = i;
  }
  for (int i = 0; i < (int)(k); ++i) {
    string s1, s2;
    cin >> s1 >> s2;
    int a = m[s1], b = m[s2];
    vis[a][b] = vis[b][a] = 1;
  }
  int mx = 0;
  for (int i = 0; i < (1 << n); i++) {
    vector<int> sub;
    for (int j = 0; j < (int)(n); ++j) {
      if (i & (1 << j)) {
        sub.push_back(j);
      }
    }
    bool ok = 1;
    for (int j : sub) {
      for (int q : sub)
        if (vis[j][q]) {
          ok = 0;
          break;
        }
      if (!ok) break;
    }
    if (ok && mx < ((int)((sub).size()))) {
      ans = sub;
      mx = ((int)((sub).size()));
    }
  }
  vector<string> s;
  for (int i = 0; i < (int)(((int)((ans).size()))); ++i)
    s.push_back(name[ans[i]]);
  sort(((s).begin()), ((s).end()));
  cout << mx << "\n";
  for (string p : s) cout << p << "\n";
  return 0;
}
