#include <bits/stdc++.h>
const double pi = acos(-1.0);
using namespace std;
inline long long MAX2(long long a, long long b) {
  return (a) > (b) ? (a) : (b);
}
inline long long MAX3(long long a, long long b, long long c) {
  return (a) > (b) ? ((a) > (c) ? (a) : (c)) : ((b) > (c) ? (b) : (c));
}
inline long long MIN2(long long a, long long b) {
  return (a) < (b) ? (a) : (b);
}
inline long long MIN3(long long a, long long b, long long c) {
  return (a) < (b) ? ((a) < (c) ? (a) : (c)) : ((b) < (c) ? (b) : (c));
}
int mod = 1e9 + 7;
int64_t extGcd(int64_t a, int64_t b, int64_t& x, int64_t& y) {
  if (!a) {
    x = 0;
    y = 1;
    return b;
  }
  int64_t x1, y1;
  int64_t d = extGcd(b % a, a, x1, y1);
  x = y1 - (b / a) * x1;
  y = x1;
  return d;
}
inline long long addmod(long long a, long long b) {
  a = a % mod + b % mod;
  if (a > mod) a %= mod;
  return a;
}
inline long long submod(long long a, long long b) {
  a = a % mod - b % mod;
  if (a < 0) a += mod;
  return a;
}
inline long long mulmod(long long a, long long b) {
  return (a % mod * b % mod) % mod;
}
int dx[] = {1, 1, 0, -1, -1, -1, 0, 1};
int dy[] = {0, 1, 1, 1, 0, -1, -1, -1};
inline long long exp(long long a, long long b) {
  if (a == 0) return 0ll;
  long long r = 1LL;
  while (b > 0) {
    if (b & 1) {
      r = r * (a % mod);
      r = (r + mod) % mod;
    }
    b /= 2;
    a = (a % mod) * (a % mod);
    a = (a + mod) % mod;
  }
  return (r + mod) % mod;
}
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  if (a == 0) return b;
  return gcd(b, a % b);
}
unsigned long int setbits(long long n) {
  unsigned long int count = 0;
  while (n) {
    n &= (n - 1);
    count++;
  }
  return count;
}
int main() {
  if (fopen("input.txt", "r"))
    freopen("input.txt", "r", stdin), freopen("output.txt", "w", stdout);
  ;
  int n, m;
  cin >> n >> m;
  map<string, int> m1;
  map<int, string> m2;
  for (int i = 0; i < n; i++) {
    string s;
    cin >> s;
    m1[s] = i;
    m2[i] = s;
  }
  map<pair<int, int>, int> enemy;
  for (int i = 0; i < m; i++) {
    string s1, s2;
    cin >> s1 >> s2;
    enemy[make_pair(m1[s1], m1[s2])]++;
    enemy[make_pair(m1[s2], m1[s1])]++;
  }
  vector<string> g1;
  int temp = 0;
  vector<string> curr_taken;
  for (long long i = 1; i <= (1LL << n); i++) {
    int cnt = 0;
    int j = i;
    while (j > 0) {
      if (j & 1) curr_taken.push_back(m2[cnt]);
      cnt++;
      j = j / 2;
    }
    bool isvalid = true;
    for (int x = 0; x < curr_taken.size(); x++) {
      for (int k = x + 1; k < curr_taken.size(); k++) {
        if (enemy[(make_pair(m1[curr_taken[x]], m1[curr_taken[k]]))]) {
          isvalid = false;
          break;
        }
      }
    }
    if (isvalid) {
      if (curr_taken.size() > g1.size()) {
        g1.clear();
        for (auto x : curr_taken) g1.push_back(x);
      }
    }
    curr_taken.clear();
  }
  cout << g1.size() << '\n';
  sort(g1.begin(), g1.end());
  for (auto x : g1) cout << x << '\n';
}
