#include <bits/stdc++.h>
using namespace std;
int n, m, cnt[17];
string name[17];
vector<int> conflic[17];
vector<int> res, cur;
bool cmp(int a, int b) { return name[a] < name[b]; }
void dfs(int now) {
  if (now == n) {
    if (cur.size() > res.size()) res = cur;
    return;
  }
  if (!cnt[now]) {
    for (int &c : conflic[now]) ++cnt[c];
    cur.push_back(now);
    dfs(now + 1);
    for (int &c : conflic[now]) --cnt[c];
    cur.pop_back();
  }
  dfs(now + 1);
}
int main() {
  map<string, int> id;
  cin >> n >> m;
  for (int i = 0; i < n; ++i) {
    cin >> name[i];
    id[name[i]] = i;
  }
  for (int i = 0, u, v; i < m; ++i) {
    string a, b;
    cin >> a >> b;
    u = id[a];
    v = id[b];
    conflic[u].push_back(v);
    conflic[v].push_back(u);
  }
  dfs(0);
  cout << res.size() << '\n';
  sort(res.begin(), res.end(), cmp);
  for (int &i : res) cout << name[i] << '\n';
}
