#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  map<string, int> nameMap;
  vector<int> markedPairs;
  vector<string> names;
  vector<string> sortedSubset;
  string name1, name2;
  for (int i = 0; i < n; i++) {
    cin >> name1;
    nameMap[name1] = i;
    names.push_back(name1);
  }
  for (int i = 0; i < m; ++i) {
    int pair = 0;
    cin >> name1 >> name2;
    pair = pair | (1 << nameMap[name1]);
    pair = pair | (1 << nameMap[name2]);
    markedPairs.push_back(pair);
  }
  int limit = 1 << n;
  int maxSubset = -1;
  int maxCounter = 0;
  for (int j = 0; j < limit; j++) {
    int subset = j;
    bool isValidSubset = true;
    for (int i = 0; i < m; ++i) {
      if ((markedPairs[i] & subset) == markedPairs[i]) {
        isValidSubset = false;
        break;
      }
    }
    if (isValidSubset) {
      int counter = __builtin_popcount(subset);
      if (counter > maxCounter) {
        maxSubset = subset;
        maxCounter = counter;
      }
    }
  }
  cout << maxCounter << endl;
  int k = 0;
  while (maxSubset) {
    if (maxSubset & 1) {
      sortedSubset.push_back(names[k]);
    }
    maxSubset >>= 1;
    k++;
  }
  sort(sortedSubset.begin(), sortedSubset.end());
  for (int i = 0; i < maxCounter; i++) {
    cout << sortedSubset[i] << endl;
  }
}
