#include <bits/stdc++.h>
#pragma GCC optimize("-Ofast", "-funroll-all-loops")
using namespace std;
long long int modularExponentiation(long long int x, long long int n,
                                    long long int M) {
  if (n == 0)
    return 1;
  else if (n % 2 == 0)
    return modularExponentiation((x * x) % M, n / 2, M);
  else
    return (x * modularExponentiation((x * x) % M, (n - 1) / 2, M)) % M;
}
long long int CeilIndex(std::vector<long long int>& v, long long int l,
                        long long int r, long long int key) {
  while (r - l > 1) {
    long long int m = l + (r - l) / 2;
    if (v[m] > key)
      r = m;
    else
      l = m;
  }
  return r;
}
long long int LongestIncreasingSubsequenceLength(
    std::vector<long long int>& v) {
  if (v.size() == 0) return 0;
  std::vector<long long int> tail(v.size(), 0);
  long long int length = 1;
  tail[0] = v[0];
  for (size_t i = 1; i < v.size(); i++) {
    if (v[i] < tail[0])
      tail[0] = v[i];
    else if (v[i] >= tail[length - 1])
      tail[length++] = v[i];
    else
      tail[CeilIndex(tail, -1, length - 1, v[i])] = v[i];
  }
  return length;
}
bool check(int m, vector<pair<int, int>> v) {
  int f = 0;
  for (int i = 0; i < v.size(); i++) {
    int x = v[i].first;
    int y = v[i].second;
    if (x > m && y > m) {
      f = 1;
      break;
    }
  }
  if (f == 1)
    return false;
  else
    return true;
}
long long int subCount(long long int arr[], long long int n, long long int k) {
  long long int mod[k];
  memset(mod, 0, sizeof(mod));
  long long int cumSum = 0;
  for (long long int i = 0; i < n; i++) {
    cumSum += arr[i];
    mod[((cumSum % k) + k) % k]++;
  }
  long long int result = 0;
  for (long long int i = 0; i < k; i++)
    if (mod[i] > 1) result += (mod[i] * (mod[i] - 1)) / 2;
  result += mod[0];
  return result;
}
bool isPerfectSquare(long double x) {
  if (x >= 0) {
    long double sr = sqrt(x);
    return (sr * sr == x);
  }
  return false;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int n, m;
  cin >> n >> m;
  vector<string> v(16);
  set<string> ans;
  for (long long int i = 0; i < n; i++) cin >> v[i];
  vector<pair<string, string>> vp(120);
  for (long long int i = 0; i < m; i++) cin >> vp[i].first >> vp[i].second;
  for (long long int i = 0; i < (1 << n); i++) {
    set<string> s;
    long long int valid = 1;
    for (long long int j = 0; j < n; j++) {
      if ((i >> j) & 1) s.insert(v[j]);
    }
    for (long long int k = 0; k < m; k++) {
      if (s.find(vp[k].first) != s.end() && s.find(vp[k].second) != s.end())
        valid = 0;
    }
    if (valid) {
      long long int size = s.size();
      if (s.size() > ans.size()) ans = s;
    }
  }
  cout << ans.size() << endl;
  for (auto it = ans.begin(); it != ans.end(); it++) cout << *it << endl;
  return 0;
}
