#include <bits/stdc++.h>
using namespace std;
int n;
map<pair<int, string>, string> dp;
vector<string> members;
map<pair<string, string>, bool> hate;
bool valid(string s, int ind) {
  for (int i = 0; i < ind; i++)
    if (s[i] == '1') {
      if (hate.count({members[ind], members[i]}) != 0) return false;
    }
  return true;
}
string solve(int ind, string team) {
  if (ind == n) return team;
  if (dp.count({ind, team}) != 0) return dp[{ind, team}];
  if (valid(team, ind)) {
    string temp = team;
    temp[ind] = '1';
    string s1 = solve(ind + 1, temp);
    string s2 = solve(ind + 1, team);
    return (count(s1.begin(), s1.end(), '1') > count(s2.begin(), s2.end(), '1'))
               ? s1
               : s2;
  } else
    return dp[{ind, team}] = solve(ind + 1, team);
}
int main() {
  int h;
  cin >> n >> h;
  string s;
  for (int i = 0; i < n; i++) {
    cin >> s;
    members.push_back(s);
  }
  sort(members.begin(), members.end());
  for (size_t i = 0; i < h; i++) {
    string s1, s2;
    cin >> s1 >> s2;
    hate[{s1, s2}] = true;
    hate[{s2, s1}] = true;
  }
  string team = "";
  for (int i = 0; i < n; i++) team += '0';
  string sol = solve(0, team);
  cout << count(sol.begin(), sol.end(), '1') << endl;
  for (int i = 0; i < sol.size(); i++)
    if (sol[i] == '1') cout << members[i] << endl;
  return 0;
}
