#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:36777216")
using namespace std;
const double pi = acos(-1.0);
const double eps = 1e-11;
const int oo = 0x3f3f3f3f;
template <class T>
inline void checkmin(T &a, T b) {
  if (b < a) a = b;
}
template <class T>
inline void checkmax(T &a, T b) {
  if (b > a) a = b;
}
template <class T>
inline T sqr(T x) {
  return x * x;
}
template <class T>
inline T lowbit(T n) {
  return (n ^ (n - 1)) & n;
}
template <class T>
inline int countbit(T n) {
  return (n == 0) ? 0 : (1 + countbit(n & (n - 1)));
}
template <class T>
inline T gcd(T a, T b) {
  T c;
  while (a != 0) {
    c = a;
    a = b % a;
    b = c;
  }
  return b;
}
template <class T>
inline T mabs(T a) {
  if (a < 0)
    return -a;
  else
    return a;
}
typedef vector<int> VI;
typedef vector<VI> VII;
typedef vector<string> VS;
const int N = (int)21;
const int MOD = (int)1e9 + 7;
int g[N][N];
inline int solve(int testnum) {
  int n, k;
  cin >> n >> k;
  map<string, int> names;
  names.clear();
  map<int, string> idx2name;
  idx2name.clear();
  for (int i = (0); i < int(n); i++) {
    string s;
    cin >> s;
    names[s] = i;
    idx2name[i] = s;
  }
  for (int i = (0); i < int(n); i++)
    for (int j = (0); j < int(n); j++) g[i][j] = 1;
  for (int i = (0); i < int(k); i++) {
    string a, b;
    cin >> a >> b;
    int ia = names[a];
    int ib = names[b];
    g[ia][ib] = 0;
  }
  int best = 0;
  for (int mask = (0); mask < int((1 << (n))); mask++) {
    int f = 1;
    for (int i = (0); i < int(n); i++) {
      if ((mask & (1 << (i))) > 0) {
        for (int j = (0); j < int(n); j++)
          if ((mask & (1 << (j))) > 0) {
            if (g[i][j] == 0) {
              f = 0;
            }
          }
      }
    }
    if (!f || !mask) continue;
    if (countbit(mask) > countbit(best)) {
      best = mask;
    }
  }
  VS ret;
  ret.clear();
  for (int b = (0); b < int(n); b++)
    if ((best & (1 << (b))) > 0) {
      ret.push_back(idx2name[b]);
    }
  sort((ret).begin(), (ret).end());
  printf("%d\n", ret.size());
  for (auto &j : ret) printf("%s\n", j.c_str());
  return 0;
}
int main(int argc, char *argv[]) {
  ios::sync_with_stdio(false);
  int t = 1;
  if (argc > 1) t = atoi(argv[1]);
  for (int _t = (1); _t < int(t + 1); _t++) {
    int ret = ::solve(_t);
    if (ret == -1) {
      cerr << "Failed test #" << _t << endl;
      break;
    }
    cerr << "Solved test #" << _t << endl;
  }
  return 0;
}
