#include <bits/stdc++.h>
using namespace std;
int main() {
  string volunteers[1000];
  map<string, int> volunteersId;
  vector<int> ids;
  vector<int> temp;
  int n, m;
  cin >> n;
  cin >> m;
  int uselessPairs[1000][1000];
  for (int i = 0; i < n; i++) {
    cin >> volunteers[i];
    volunteersId.insert(std::make_pair(volunteers[i], i));
  }
  for (int i = 0; i < m; i++) {
    string firstVolunteer;
    string secondVolunteer;
    cin >> firstVolunteer;
    cin >> secondVolunteer;
    uselessPairs[volunteersId.at(firstVolunteer)]
                [volunteersId.at(secondVolunteer)] = 1;
    uselessPairs[volunteersId.at(secondVolunteer)]
                [volunteersId.at(firstVolunteer)] = 1;
  }
  int foundedMask = -1;
  int activeBits = -1;
  for (int i = 0; i < 1 << n; i++) {
    bool foundUseless = false;
    for (int j = 0; j < n; j++) {
      if ((i & (1 << j)) == 0) continue;
      for (int k = 0; k < n; k++) {
        if (j == k || ((i & (1 << k)) == 0)) continue;
        if (uselessPairs[j][k]) {
          foundUseless = true;
          break;
        }
      }
    }
    if (!foundUseless) {
      if (__builtin_popcount(i) > activeBits) {
        activeBits = __builtin_popcount(i);
        foundedMask = i;
      }
    }
  }
  vector<string> temp2;
  for (int i = 0; i < n; i++) {
    if (foundedMask & (1 << i)) {
      temp2.push_back(volunteers[i]);
    }
  }
  sort(temp2.begin(), temp2.end());
  cout << activeBits << endl;
  for (int i = 0; i < temp2.size(); i++) {
    cout << temp2.at(i) << endl;
  }
  return 0;
}
