#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  if (a == 0) return b;
  return gcd(b % a, a);
}
long long lcm(long long a, long long b) { return (a * b) / gcd(a, b); }
long long power(long long x, long long y) {
  long long res = 1;
  while (y > 0) {
    if (y & 1) res = res * x;
    y = y >> 1;
    x = x * x;
  }
  return res;
}
void dfs(long long src, bool visited[], vector<long long> adj[],
         vector<long long> &v) {
  visited[src] = true;
  v.push_back(src);
  for (auto i : adj[src]) {
    if (!visited[i]) dfs(i, visited, adj, v);
  }
}
int main() {
  int n, m;
  cin >> n >> m;
  vector<string> s(n);
  for (int i = 0; i < n; i++) {
    cin >> s[i];
  }
  sort(s.begin(), s.end());
  int no[n][n];
  memset(no, 0, sizeof(no));
  map<string, int> mp;
  for (int i = 0; i < n; i++) {
    mp[s[i]] = i;
  }
  vector<pair<int, int>> pp(m);
  for (int i = 0; i < m; i++) {
    string s, t;
    cin >> s >> t;
    int x = mp[s];
    int y = mp[t];
    no[x][y] = 1;
    no[y][x] = 1;
  }
  vector<int> v, ans;
  for (int i = 0; i < 1 << n; i++) {
    for (int j = 0; j < n; j++)
      if (i & (1 << j)) v.push_back(j);
    int temp = 1;
    for (int j = 0; j < v.size(); j++) {
      for (int k = j + 1; k < v.size(); k++) {
        if (no[v[j]][v[k]] == 1) {
          temp = 0;
          break;
        }
      }
    }
    if (temp and v.size() > ans.size()) {
      ans = v;
      v.clear();
    } else {
      v.clear();
    }
  }
  cout << ans.size() << endl;
  for (int i = 0; i < ans.size(); i++) {
    cout << s[ans[i]] << endl;
  }
}
