#include <bits/stdc++.h>
using namespace std;
const int N = 18;
const int MSK = 1 << N;
int dp[MSK];
int best[MSK];
int n, m;
char str[N], a[N], b[N];
string s[N];
map<string, int> nametoid;
vector<int> adj[N];
vector<string> ans;
int solve(int msk = 0, int take = 0) {
  if (take == n) return 0;
  int &ret = dp[msk];
  if (~ret) return ret;
  ret = 0;
  for (int i = 0; i < int(n); i++) {
    if (msk & (1 << i)) continue;
    int cnt = 1;
    int add = (1 << i);
    for (int nxt : adj[i]) {
      if (msk & (1 << nxt)) continue;
      add |= (1 << nxt);
      cnt++;
    }
    if (ret < solve(msk | add, take + cnt) + 1) {
      ret = solve(msk | add, take + cnt) + 1;
      best[msk] = i;
    }
  }
  return ret;
}
void construct(int msk = 0, int take = 0) {
  if (take == n) return;
  int r = 0;
  for (int i = 0; i < int(n); i++) {
    if (msk & (1 << i)) continue;
    int cnt = 1;
    int add = (1 << i);
    for (int nxt : adj[i]) {
      if (msk & (1 << nxt)) continue;
      add |= (1 << nxt);
      cnt++;
    }
    if (dp[msk] == solve(msk | add, take + cnt) + 1) {
      ans.push_back(s[i]);
      construct(msk | add, take + cnt);
      return;
    }
  }
}
int main() {
  scanf("%d %d", &n, &m);
  for (int i = 0; i < int(n); i++) {
    scanf("%s", str);
    s[i] = string(str);
    nametoid[s[i]] = i;
  }
  for (int i = 0; i < int(m); i++) {
    scanf("%s%s", a, b);
    adj[nametoid[string(a)]].push_back(nametoid[string(b)]);
    adj[nametoid[string(b)]].push_back(nametoid[string(a)]);
  }
  memset(dp, -1, sizeof dp);
  memset(best, -1, sizeof dp);
  printf("%d\n", solve());
  construct();
  sort(ans.begin(), ans.end());
  for (int i = 0; i < int(int(ans.size())); i++) printf("%s\n", ans[i].c_str());
  return 0;
}
