#include <bits/stdc++.h>
using namespace std;
const int inf = (int)(1e9);
const int mod = inf + 7;
const double pi = acos(-1.0);
const double eps = 1e-9;
map<string, int> id;
int n, m;
string second, t, b[100];
bool a[100][100];
vector<int> v;
bool was[1 << 17];
bool check(int mask) {
  bool ok = 1;
  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      if ((mask & (1 << j)) && (mask & (1 << i)) && a[i][j]) {
        ok = 0;
        break;
      }
    }
    if (!ok) break;
  }
  return ok;
}
int bitcnt(int mask) {
  int k = 0;
  for (int i = 0; i < n; i++)
    if (mask & (1 << i)) k++;
  return k;
}
bool cmp(int a, int b) {
  int k1 = 0, k2 = 0;
  for (int i = 0; i < n; i++) {
    if (a & (1 << i)) k1++;
    if (b & (1 << i)) k2++;
  }
  return (k1 <= k2);
}
int main() {
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    cin >> second;
    id[second] = i;
    b[i] = second;
  }
  for (int i = 0; i < m; i++) {
    cin >> second >> t;
    a[id[second]][id[t]] = 1;
    a[id[t]][id[second]] = 1;
  }
  for (int i = 0; i < (1 << n); i++) {
    if (check(i)) v.push_back(i);
  }
  int mask = -1, p = -inf;
  for (int i = 0; i < (int)v.size(); i++) {
    int k = bitcnt(v[i]);
    if (p < k) {
      p = k;
      mask = v[i];
    }
  }
  set<string> ans;
  for (int i = 0; i < n; i++)
    if (mask & (1 << i)) ans.insert(b[i]);
  printf("%d\n", (int)ans.size());
  for (__typeof(ans.begin()) it = ans.begin(); it != ans.end(); it++)
    cout << *it << endl;
  return 0;
}
