#include <bits/stdc++.h>
const double eps = 1e-8;
const double pi = 3.1415926535897932;
using namespace std;
int n;
map<string, int> A;
vector<vector<bool> > Graph;
bool check(queue<int> A, queue<int> B) {
  int a, b;
  queue<int> X;
  while (B.size() > 0) {
    bool all = true;
    b = B.front();
    B.pop();
    X = A;
    while (X.size() > 0) {
      a = X.front();
      X.pop();
      if (a != b && !Graph[a][b]) {
        all = false;
        break;
      }
    }
    if (all) return true;
  }
  return false;
}
queue<int> remake(queue<int> X, int n) {
  queue<int> res;
  int z;
  while (X.size() > 0) {
    z = X.front();
    X.pop();
    if (z != n) res.push(z);
  }
  return res;
}
queue<int> nots(int n, queue<int> A) {
  queue<int> res;
  int t;
  while (A.size() > 0) {
    t = A.front();
    A.pop();
    if (Graph[n][t]) {
      res.push(t);
    }
  }
  return res;
}
queue<int> compsub;
void click(queue<int> Cand, queue<int> Not, vector<queue<int> > &res) {
  int t;
  queue<int> temp, ans, newcand, newnot;
  while (Cand.size() != 0 && !check(Cand, Not)) {
    t = Cand.front();
    compsub.push(t);
    newcand = nots(t, Cand);
    newnot = nots(t, Not);
    if (newcand.size() == 0 && newnot.size() == 0) {
      res.push_back(compsub);
    } else {
      click(newcand, newnot, res);
    }
    compsub = remake(compsub, t);
    Cand = remake(Cand, t);
    Not.push(t);
  }
}
int main() {
  int m;
  cin >> n >> m;
  vector<string> Str(n + 1), OKAY;
  string s, y;
  Graph.assign(n + 1, vector<bool>(n + 1, true));
  queue<int> Ans, Cand, Not;
  for (int i = 1; i <= n; i++) {
    cin >> s;
    A[s] = i;
    Cand.push(i);
    Graph[i][i] = false;
    Str[i] = s;
  }
  for (int i = 0; i < m; i++) {
    cin >> s >> y;
    Graph[A[s]][A[y]] = Graph[A[y]][A[s]] = false;
  }
  vector<queue<int> > OMG;
  click(Cand, Not, OMG);
  int max = 0;
  for (int i = 1; i < OMG.size(); i++) {
    if (OMG[i].size() > OMG[max].size()) max = i;
  }
  Ans = OMG[max];
  while (Ans.size() > 0) {
    OKAY.push_back(Str[Ans.front()]);
    Ans.pop();
  }
  sort(OKAY.begin(), OKAY.end());
  int ans = 1;
  for (int i = 1; i < OKAY.size(); i++)
    if (OKAY[i] != OKAY[i - 1]) ans++;
  cout << ans << endl << OKAY[0] << endl;
  for (int i = 1; i < OKAY.size(); i++) {
    if (OKAY[i] != OKAY[i - 1]) cout << OKAY[i] << endl;
  }
  return 0;
}
