#include <bits/stdc++.h>
using namespace std;
struct comp {
  bool operator()(const vector<int>& lhs, const vector<int>& rhs) const {
    return lhs.size() > rhs.size();
  }
};
struct comps {
  bool operator()(const string& lhs, const string& rhs) const {
    return lhs > rhs;
  }
};
bool ff(pair<int, int> a, pair<int, int> b) { return a.first < b.first; }
double dis(double x1, double y1, double x2, double y2) {
  return sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1));
}
int gcd(long long unsigned int a, long long unsigned int b) {
  return (b == 0) ? a : gcd(b, a % b);
}
int comb(int a, int b) {
  if (a == 0) return 1;
  if (a < b) return 1;
  if (a == b) return 1;
  if (b == 1) return a;
  if (b == 0) return 1;
  long long unsigned int aa = 1, bb = 1;
  for (int i = b; i > 0; i--, a--) {
    aa *= a;
    bb *= i;
    int gc = gcd(aa, bb);
    if (gc > 1) {
      aa /= gc;
      bb /= gc;
    }
  }
  return aa % 1000000007;
}
bool isprime(long long unsigned int n) {
  for (int i = 2; i <= sqrt(n); i++)
    if (n % i == 0) return false;
  return true;
}
int main() {
  int n, mm;
  string s[16];
  string x, y;
  map<string, vector<string> > m;
  scanf("%d%d", &n, &mm);
  for (int i = 0; i < n; i++) cin >> s[i];
  for (int i = 0; i < mm; i++) {
    cin >> x >> y;
    m[x].push_back(y);
    m[y].push_back(x);
  }
  int mx = 0;
  vector<string> w;
  for (int i = 0; i < (1 << (n + 1)); i++) {
    vector<string> v;
    for (int j = 0; j < n; j++)
      if (i & (1 << j)) v.push_back(s[j]);
    for (int j = 0; j < v.size(); j++)
      for (int k = 0; k < m[v[j]].size(); k++)
        for (int l = 0; l < v.size(); l++)
          if (v[l] == m[v[j]][k]) goto label;
    mx = max(mx, (int)v.size());
    if (mx == (int)v.size()) w = v;
  label:;
  }
  sort(w.begin(), w.end());
  cout << mx << endl;
  for (int i = 0; i < w.size(); i++) cout << w[i] << endl;
  return 0;
}
