#include <bits/stdc++.h>
using namespace std;
template <typename T>
T gcd(T a, T b) {
  return b ? gcd(b, a % b) : a;
}
template <typename T>
T lcm(T a, T b) {
  return a * b / gcd(a, b);
}
template <typename T>
T sqr(T x) {
  return x * x;
}
template <typename T>
T cube(T x) {
  return x * sqr(x);
}
string out(long long x) {
  stringstream ss;
  ss << x;
  string res;
  ss >> res;
  return res;
}
long long out(string s) {
  stringstream ss;
  ss << s;
  long long res;
  ss >> res;
  return res;
}
const int MAXN = 16 + 1;
bool isbad[MAXN][MAXN];
int main() {
  int n, m;
  cin >> n >> m;
  map<string, int> M;
  vector<string> MM;
  for (int i = 0; i < (n); i++) {
    string s;
    cin >> s;
    M[s] = i;
    MM.push_back(s);
  }
  for (int kkk = 0; kkk < (m); kkk++) {
    string s1, s2;
    cin >> s1 >> s2;
    isbad[M[s1]][M[s2]] = true;
    isbad[M[s2]][M[s1]] = true;
  }
  int res = -1;
  vector<string> p;
  for (int mask = 0; mask < (1 << n); mask++) {
    vector<int> v;
    for (int i = 0; i < (n); i++) {
      if ((1 << i) & mask) v.push_back(i);
    }
    bool f = true;
    for (int i = 0; i < (v.size()); i++) {
      for (int j = 0; j < (v.size()); j++) {
        if (i == j) continue;
        if (isbad[v[i]][v[j]]) {
          f = false;
        }
      }
    }
    if (f) {
      if (res < (int)v.size()) {
        p.clear();
        p.resize(v.size());
        for (int i = 0; i < (p.size()); i++) {
          p[i] = MM[v[i]];
        }
        res = v.size();
      }
    }
  }
  sort(p.begin(), p.end());
  cout << res << endl;
  for (int i = 0; i < (res); i++) {
    cout << p[i] << endl;
  }
  return 0;
}
