#include <bits/stdc++.h>
using namespace std;
template <typename T>
T max3(T a, T b, T c) {
  return max(a, max(b, c));
}
template <typename T>
T max4(T a, T b, T c, T d) {
  return max(max(a, d), max(b, c));
}
template <typename T>
T min3(T a, T b, T c) {
  return min(a, min(b, c));
}
template <typename T>
T min4(T a, T b, T c, T d) {
  return min(min(a, d), min(b, c));
}
template <typename T>
T binex(T a, T b, T mod) {
  T ans = 1;
  while (b > 0) {
    if (b & 1) {
      ans *= a;
      ans %= mod;
    }
    a *= a;
    a %= mod;
    b >>= 1;
  }
  return ans;
}
template <class T>
ostream& operator<<(ostream& os, vector<T> a) {
  for (auto x : a) {
    os << x << " ";
  }
  return os << "\n";
}
template <class T>
ostream& operator<<(ostream& os, set<T> a) {
  for (auto x : a) {
    os << x << " ";
  }
  return os << "\n";
}
void precomp() {}
void solve() {
  int64_t n, m;
  cin >> n >> m;
  map<string, int> a;
  map<int, string> arev;
  for (int i = 0; i < n; i++) {
    string x;
    cin >> x;
    a[x] = i;
    arev[i] = x;
  }
  vector<pair<int64_t, int64_t>> sto;
  for (int i = 0; i < m; i++) {
    string x, y;
    cin >> x >> y;
    sto.push_back(make_pair(min(a[x], a[y]), max(a[x], a[y])));
  }
  int maxmem = 1;
  int team = 1;
  for (int i = 1; i < 1 << n; i++) {
    int num = __builtin_popcount(i);
    if (num == 1) {
      continue;
    }
    int val = 0;
    for (int j = 0; j < m; j++) {
      if ((i & 1 << sto[j].first) && (i & 1 << sto[j].second)) {
        val = 1;
        break;
      }
    }
    if (val == 0 && num > maxmem) {
      maxmem = num;
      team = i;
    }
  }
  cout << maxmem << "\n";
  vector<string> ans;
  for (int i = 0; i < n; i++) {
    if (team % 2) {
      ans.push_back(arev[i]);
    }
    team /= 2;
  }
  sort(ans.begin(), ans.end());
  for (int i = 0; i < ans.size(); i++) {
    cout << ans[i] << "\n";
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int64_t T;
  T = 1;
  precomp();
  for (int64_t I = 1; I <= T; I++) {
    solve();
  }
}
