#include <bits/stdc++.h>
using namespace std;
void f(char *s) {
  while (*s) {
    if ('A' <= *s && *s <= 'Z') *s += 'a' - 'A';
    if (*s == 'o') *s = '0';
    if (*s == 'l' || *s == 'i') *s = '1';
    ++s;
  }
}
const int MAX_L = 70;
char S[MAX_L], T[MAX_L];
int main() {
  gets(S), f(S);
  int N;
  scanf("%d\n", &N);
  for (int i = 0; i < (N); ++i) {
    gets(T), f(T);
    if (!strcmp(S, T)) {
      puts("No");
      return 0;
    }
  }
  puts("Yes");
  return 0;
}
