#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;
  a %= mod;
  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;
}
template <class T>
ostream &operator<<(ostream &os, set<T> a) {
  for (auto x : a) {
    os << x << " ";
  }
  return os;
}
template <class T, class Q>
ostream &operator<<(ostream &os, pair<T, Q> a) {
  os << "| ";
  os << a.first << ", " << a.second << " ";
  return os << "|";
}
void precomp() {}
bool check(vector<vector<int64_t>> &sto, int64_t n) {
  int64_t p1 = 0;
  while (n >= (1 << p1)) {
    if (!(n & (1 << p1))) {
      p1++;
      continue;
    }
    for (auto x : sto[p1]) {
      if (n & (1 << x)) {
        return false;
      }
    }
    p1++;
  }
  return true;
}
void solve() {
  int64_t n, m;
  cin >> n >> m;
  vector<string> name(n);
  map<string, int64_t> rev;
  for (int64_t i = 0; i < n; i++) {
    cin >> name[i];
    rev[name[i]] = i;
  }
  vector<vector<int64_t>> sto(n + 1);
  for (int64_t i = 0; i < m; i++) {
    string a, b;
    cin >> a >> b;
    sto[rev[a]].push_back(rev[b]);
    sto[rev[b]].push_back(rev[a]);
  }
  int64_t ans = 0;
  int64_t curr = 0;
  for (int64_t i = 1; i < (1 << n); i++) {
    if (curr >= __builtin_popcount(i)) {
      continue;
    }
    if (check(sto, i)) {
      curr = __builtin_popcount(i);
      ans = i;
    }
  }
  vector<string> fans;
  for (int64_t i = 0; i < n; i++) {
    if (ans & (1 << i)) {
      fans.push_back(name[i]);
    }
  }
  sort(fans.begin(), fans.end());
  cout << fans.size() << "\n";
  for (int64_t i = 0; i < fans.size(); i++) {
    cout << fans[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();
  }
}
