#include <bits/stdc++.h>
using namespace std;
int n, m, ans = 0;
map<string, int> mp;
vector<string> names;
pair<vector<string>, int> Solve(int i, vector<int> g[], int v[]) {
  if (i == n) return make_pair(vector<string>(), 0);
  pair<vector<string>, int> maxN = Solve(i + 1, g, v);
  if (!v[i]) {
    for (int j = 0; j < g[i].size(); j++) v[g[i][j]]++;
    pair<vector<string>, int> temp = Solve(i + 1, g, v);
    temp.first.push_back(names[i]);
    temp.second++;
    if (temp.second > maxN.second) maxN = temp;
    for (int j = 0; j < g[i].size(); j++) v[g[i][j]]--;
  }
  return maxN;
}
int main() {
  cin >> n >> m;
  vector<int> g[n];
  string s, a, b;
  for (int i = 0; i < n; i++) {
    cin >> s;
    names.push_back(s);
    mp[s] = i;
  }
  for (int i = 0; i < m; i++) {
    cin >> a >> b;
    g[mp[a]].push_back(mp[b]);
    g[mp[b]].push_back(mp[a]);
  }
  int v[n];
  memset(v, 0, sizeof v);
  pair<vector<string>, int> p = Solve(0, g, v);
  cout << p.second << endl;
  sort(p.first.begin(), p.first.end());
  for (int i = 0; i < p.first.size(); i++) cout << p.first[i] << endl;
  return 0;
}
