#include <bits/stdc++.h>
using namespace std;
const int INF = 1000000;
const int MAX = 17;
map<string, int> id;
map<int, string> unid;
vector<string> answer;
bool check[MAX][MAX];
vector<int> now;
int main() {
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    string name;
    cin >> name;
    id[name] = i;
    unid[i] = name;
  }
  for (int i = 0; i < m; i++) {
    string a, b;
    cin >> a >> b;
    check[id[a]][id[b]] = true;
    check[id[b]][id[a]] = true;
  }
  int ans = -1;
  int ind;
  for (int i = 0; i < (1 << n); i++) {
    int tmp = 0;
    int cur = i;
    while (cur != 0) {
      if (cur % 2 == 1) tmp++;
      now.push_back(cur % 2);
      cur /= 2;
    }
    while (now.size() != n) {
      now.push_back(0);
    }
    reverse(now.begin(), now.end());
    bool mark = true;
    for (int k = 0; k < now.size(); k++) {
      for (int j = 0; j < now.size(); j++) {
        if (now[k] == 1 and now[j] == 1 and check[k][j] == true) {
          mark = false;
          break;
        }
      }
      if (mark == false) {
        break;
      }
    }
    if (mark == true) {
      if (ans < tmp) ind = i;
      ans = max(ans, tmp);
    }
    now.clear();
  }
  cout << ans << endl;
  while (ind != 0) {
    now.push_back(ind % 2);
    ind /= 2;
  }
  while (now.size() != n) now.push_back(0);
  reverse(now.begin(), now.end());
  for (int i = 0; i < now.size(); i++) {
    if (now[i] == 1) {
      answer.push_back(unid[i]);
    }
  }
  sort(answer.begin(), answer.end());
  for (int i = 0; i < answer.size(); i++) cout << answer[i] << endl;
}
