#include <bits/stdc++.h>
using namespace std;
map<string, int> mp;
vector<string> vec;
string inv[20];
int e[20][20];
int n, m, ma = -1, maxn;
string a, b;
int cnt(int a) {
  int c;
  for (int i = 0; i < n; i++)
    if (a & (1 << i)) c++;
  return c;
}
int main() {
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    cin >> inv[i];
    mp[inv[i]] = i;
  }
  for (int i = 1; i <= m; i++) {
    cin >> a >> b;
    e[mp[a]][mp[b]] = e[mp[b]][mp[a]] = 1;
  }
  for (int te = 0; te < (1 << n); te++) {
    if (cnt(te) <= cnt(maxn)) continue;
    bool ok = true;
    for (int i = 0; i < n; i++) {
      for (int j = i + 1; j < n; j++) {
        if ((te & (1 << i)) && (te & (1 << j)) && e[i][j] == 1) {
          ok = false;
          break;
        }
      }
      if (ok == false) break;
    }
    if (ok == false) continue;
    maxn = te;
  }
  for (int i = 0; i < n; i++)
    if (maxn & (1 << i)) vec.push_back(inv[i]);
  sort(vec.begin(), vec.end());
  cout << vec.size() << endl;
  for (int i = 0; i < vec.size(); i++) cout << vec[i] << endl;
  return 0;
}
