#include <bits/stdc++.h>
using namespace std;
int n, m;
string a[20];
map<string, int> mapp;
vector<int> vv[20], v;
int ma = -1;
vector<string> ans;
void dfs() {
  if (v.size() == n) {
    int f = 1, s = 0;
    for (int i = 0; i < n; i++) {
      if (v[i]) {
        s++;
        for (int j = 0; j < vv[i + 1].size(); j++) {
          if (v[vv[i + 1][j] - 1] == 1) {
            f = 0;
          }
        }
      }
    }
    if (f == 1) {
      if (ma < s) {
        ans.clear();
        for (int i = 0; i < n; i++) {
          if (v[i]) {
            ans.push_back(a[i + 1]);
          }
        }
        ma = s;
      }
    }
  } else {
    v.push_back(0);
    dfs();
    v.pop_back();
    v.push_back(1);
    dfs();
    v.pop_back();
  }
}
int main() {
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    mapp[a[i]] = i;
  }
  for (int i = 1; i <= m; i++) {
    string x, y;
    cin >> x >> y;
    vv[mapp[x]].push_back(mapp[y]);
    vv[mapp[y]].push_back(mapp[x]);
  }
  dfs();
  sort(ans.begin(), ans.end());
  cout << ma << endl;
  for (int i = 0; i < ans.size(); i++) {
    cout << ans[i] << endl;
  }
}
