#include <bits/stdc++.h>
using namespace std;
class names {
 public:
  string name;
};
bool operator<(names a, names b) {
  if (a.name != b.name) {
    return lexicographical_compare(a.name.begin(), a.name.end(), b.name.begin(),
                                   b.name.end());
  }
  return false;
}
map<int, string> mm;
void printResult(vector<int>& v) {
  vector<names> n;
  for (int i = 0; i < v.size(); i++) {
    names cur;
    cur.name = mm[v[i]];
    n.push_back(cur);
  }
  sort(n.begin(), n.end());
  cout << n.size() << endl;
  for (int i = 0; i < n.size(); i++) {
    cout << n[i].name << endl;
  }
}
int main() {
  int N, M;
  cin >> N >> M;
  map<string, int> m;
  string name = "";
  for (int i = 0; i < N; i++) {
    cin >> name;
    m[name] = i;
    mm[i] = name;
  }
  string a = "";
  string b = "";
  set<pair<int, int> > s;
  for (int i = 0; i < M; i++) {
    cin >> a >> b;
    int ind_a = m[a];
    int ind_b = m[b];
    pair<int, int> p;
    p.first = min(ind_a, ind_b);
    p.second = max(ind_a, ind_b);
    s.insert(p);
  }
  int maxP = 0;
  vector<int> maxM;
  for (int i = 0; i < (1 << N); i++) {
    vector<int> tmp;
    for (int j = 0; j < N; j++) {
      if (i & (1 << j)) {
        tmp.push_back(j);
      }
    }
    if ((int)tmp.size() <= maxP) continue;
    bool found = true;
    for (int k = 0; k < tmp.size() - 1; k++) {
      for (int l = k + 1; l < tmp.size(); l++) {
        pair<int, int> p;
        p.first = tmp[k];
        p.second = tmp[l];
        if (s.count(p)) {
          found = false;
          break;
        }
      }
    }
    if (found) {
      maxP = tmp.size();
      maxM = tmp;
    }
  }
  printResult(maxM);
  return 0;
}
