#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, ans = 0, maxi = 0;
  cin >> n >> m;
  vector<string> g(n);
  for (int i = 0; i < n; i += 1) {
    cin >> g[i];
  }
  map<pair<string, string>, int> mp;
  for (int i = 0; i < m; i += 1) {
    string a, b;
    cin >> a >> b;
    mp[{a, b}] = 1;
    mp[{b, a}] = 1;
  }
  for (int i = 0; i < (1 << n); i += 1) {
    bool t = true;
    int v = 0;
    for (int j = 0; j < n; j += 1) {
      if (!(i & (1 << j))) {
        continue;
      }
      v += 1;
      for (int k = j + 1; k < n; k += 1) {
        if (!(i & (1 << k))) {
          continue;
        }
        if (mp[{g[j], g[k]}] == 1) {
          t = false;
          break;
        }
      }
    }
    if (t && v > maxi) {
      maxi = v;
      ans = i;
    }
  }
  cout << maxi << endl;
  vector<string> ret;
  for (int i = 0; i < n; i += 1) {
    if (ans & (1 << i)) {
      ret.push_back(g[i]);
    }
  }
  sort(ret.begin(), ret.end());
  for (string i : ret) {
    cout << i << endl;
  }
}
