#include <bits/stdc++.h>
using namespace std;
long long mod = (long long)(1e13) + 7LL;
long long osn = 137LL;
long long getHash(string &s) {
  long long res = 0LL, curr = osn;
  for (int i = 0; i < s.size(); i++) {
    if (s[i] >= 65 && s[i] <= 90) s[i] += 32;
    if (s[i] == 'o') s[i] = '0';
    if (s[i] == 'l' || s[i] == 'i') s[i] = '1';
    res += curr * (long long)(s[i]);
    curr *= osn;
  }
  return res;
}
int main() {
  string s, t;
  long long s_hash;
  cin >> s;
  s_hash = getHash(s);
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> t;
    if (getHash(t) == s_hash) {
      cout << "No";
      return 0;
    }
  }
  cout << "Yes";
  return 0;
}
