#include <bits/stdc++.h>
using namespace std;
const long long int mod = 1000 * 1000 * 1000 + 7;
const double PI = 3.14159265358979323846264;
const pair<long long int, long long int> steps[] = {
    {1, 0}, {0, 1}, {-1, 0}, {0, -1}, {1, -1}, {1, 1}, {-1, -1}, {-1, 1}};
template <typename... T>
void read(T&... args) {
  ((cin >> args), ...);
}
template <typename... T>
void write(T&&... args) {
  ((cout << args << " "), ...);
}
void fio() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
}
void setUpLocal() {}
const long long int maxn = 20;
long long int n, m;
map<string, long long int> mp;
map<long long int, string> revmp;
long long int gp[maxn][maxn];
vector<long long int> ans;
bool check(vector<long long int> v) {
  for (long long int i : v)
    for (long long int j : v)
      if (gp[i][j]) return false;
  return true;
}
bool comp(long long int i, long long int j) { return revmp[i] < revmp[j]; }
void solve() {
  cin >> n >> m;
  long long int cnt = -1;
  long long int _n = n;
  while (_n--) {
    string s;
    cin >> s;
    mp[s] = ++cnt;
    revmp[cnt] = s;
  }
  string u, v;
  while (m--) {
    cin >> u >> v;
    gp[mp[u]][mp[v]] = 1;
    gp[mp[v]][mp[u]] = 1;
  }
  for (long long int i = 1; i < (1 << n); i++) {
    vector<long long int> v;
    for (long long int j = 0; j < n; j++) {
      if (((i) & (1 << (j)))) v.push_back(j);
    }
    if (v.size() > ans.size())
      if (check(v)) ans = v;
  }
  cout << ans.size() << '\n';
  sort(ans.begin(), ans.end(), comp);
  for (long long int i : ans) cout << revmp[i] << '\n';
}
int32_t main() {
  fio();
  setUpLocal();
  return solve(), 0;
}
