When registering in a social network, users are allowed to create their own convenient login to make it easier to share contacts, print it on business cards, etc.

Login is an arbitrary sequence of lower and uppercase latin letters, digits and underline symbols («_»). However, in order to decrease the number of frauds and user-inattention related issues, it is prohibited to register a login if it is similar with an already existing login. More precisely, two logins s and t are considered similar if we can transform s to t via a sequence of operations of the following types:   transform lowercase letters to uppercase and vice versa;  change letter «O» (uppercase latin letter) to digit «0» and vice versa;  change digit «1» (one) to any letter among «l» (lowercase latin «L»), «I» (uppercase latin «i») and vice versa, or change one of these letters to other. 

For example, logins «Codeforces» and «codef0rces» as well as «OO0OOO00O0OOO0O00OOO0OO_lol» and «OO0OOO0O00OOO0O00OO0OOO_1oI» are considered similar whereas «Codeforces» and «Code_forces» are not.

You're given a list of existing logins with no two similar amonst and a newly created user login. Check whether this new login is similar with any of the existing ones.


-----Input-----

The first line contains a non-empty string s consisting of lower and uppercase latin letters, digits and underline symbols («_») with length not exceeding 50  — the login itself.

The second line contains a single integer n (1 ≤ n ≤ 1 000) — the number of existing logins.

The next n lines describe the existing logins, following the same constraints as the user login (refer to the first line of the input). It's guaranteed that no two existing logins are similar.


-----Output-----

Print «Yes» (without quotes), if user can register via this login, i.e. none of the existing logins is similar with it.

Otherwise print «No» (without quotes).


-----Examples-----
Input
1_wat
2
2_wat
wat_1

Output
Yes

Input
000
3
00
ooA
oOo

Output
No

Input
_i_
3
__i_
_1_
I

Output
No

Input
La0
3
2a0
La1
1a0

Output
No

Input
abc
1
aBc

Output
No

Input
0Lil
2
LIL0
0Ril

Output
Yes



-----Note-----

In the second sample case the user wants to create a login consisting of three zeros. It's impossible due to collision with the third among the existing.

In the third sample case the new login is similar with the second one.

Difficulty: MEDIUM

Solutions:
def rep(data):
	data = data.replace('0', '@@@')
	data = data.replace('o', '@@@')
	data = data.replace('1', '!!!')
	data = data.replace('l', '!!!')
	data = data.replace('i', '!!!')
	return data
login_usr = rep(input().lower())
count_log = int(input())
data_log = list(map(rep, [input().lower() for i in range(count_log)]))
for data in data_log:
	if data == login_usr:
		count_log = 0
		break
	else:
		count_log = 1
if count_log:
	print('Yes')
else:
	print('No')


from sys import stdin
import re

def chs(s, l):
	s = s.upper().replace('O', '0')
	return l.sub('1', s.rstrip('\n'))

def main():
	l = re.compile('[LI]')
	s = chs(next(stdin), l)
	next(stdin)
	for line in stdin:
		if s == chs(line, l):
			print('No')
			break
	else:
		print('Yes')
main()


def check(s, t):
	if len(s) != len(t):
		return False
	s = s.lower()
	t = t.lower()
	for i in range(len(s)):
		if s[i] == t[i]:
			continue
		elif s[i] == '0' and t[i] == 'o' or (t[i] == '0' and s[i] == 'o'):
			continue
		elif s[i] == '1' and (t[i] == 'i' or t[i] == 'l') or (t[i] == '1' and (s[i] == 'i' or s[i] == 'l')):
			continue
		elif s[i] == 'i' and (t[i] == '1' or t[i] == 'l') or (t[i] == 'i' and (s[i] == '1' or s[i] == 'l')):
			continue
		elif s[i] == 'l' and (t[i] == '1' or t[i] == 'i') or (t[i] == 'l' and (s[i] == '1' or s[i] == 'i')):
			continue
		else:
			return False
	return True
s = input()
n = int(input())
ans = False
for i in range(n):
	t = input()
	ans |= check(s, t)
if ans:
	print('No')
else:
	print('Yes')


def makeUnique(s):
	return s.lower().replace('i', '1').replace('o', '0').replace('l', '1')
login = makeUnique(input())
for i in range(int(input())):
	if makeUnique(input()) == login:
		print('No')
		exit()
print('Yes')


s = str(input())
n = int(input())
l = []
while n:
	l.append(str(input()))
	n -= 1

def get(s, l):
	for x in range(len(l)):
		if s.lower() == l[x].lower():
			return 'No'
		if '0' in s:
			if s.find('0') == l[x].lower().find('o'):
				if s.lower() == l[x].lower().replace('o', '0'):
					return 'No'
		if 'o' in s or 'O' in s:
			if s.lower().find('o') == l[x].find('0'):
				if s.lower() == l[x].lower().replace('0', 'o'):
					return 'No'
		if '1' in s:
			if s.find('1') == l[x].lower().find('i') or s.find('1') == l[x].lower().find('l'):
				if s.lower() == l[x].lower().replace('i', '1') or s.lower() == l[x].lower().replace('l', '1'):
					return 'No'
		if 'l' in s or 'L' in s:
			if s.lower().find('l') == l[x].lower().find('i') or s.lower().find('l') == l[x].find('1'):
				if s.lower() == l[x].lower().replace('i', 'l') or s.lower() == l[x].lower().replace('1', 'l'):
					return 'No'
		if 'i' in s or 'I' in s:
			if s.lower().find('i') == l[x].lower().find('l') or s.lower().find('i') == l[x].find('1'):
				if s.lower() == l[x].lower().replace('l', 'i') or s.lower() == l[x].lower().replace('1', 'i'):
					return 'No'
	return 'Yes'
if get(s, l) == None:
	print('Yes')
else:
	print(get(s, l))


logins = []
login = input()
n = int(input())
ErrorMessage = 'No'
SuccessMessage = 'Yes'

def init(login):
	delete_chars = ['1', 'i', 'l', 'o', '0']
	del_chars_i = ['1', 'i', 'l']
	del_chars_o = ['o', '0']
	res = login
	for i in delete_chars:
		while res.count(i) > 0:
			if i in del_chars_o:
				res = res.replace(i, 'Ꮗ')
			elif i in del_chars_i:
				res = res.replace(i, 'Ꮘ')
	return res

def start():
	res = []
	for i in logins:
		res.append(init(i.lower()))
	return res

def validate1(login):
	login = login.lower()
	logins = start()
	if init(login) in logins:
		return False
	return True
for i in range(n):
	login_ = input()
	if not len(login_) != len(login):
		logins.append(login_.lower())
if login.lower() in logins:
	print(ErrorMessage)
else:
	result = validate1(login)
	if result == True:
		print(SuccessMessage)
	else:
		print(ErrorMessage)


def check(a, b):
	if len(a) != len(b):
		return 0
	if a == b:
		return 1
	else:
		for i in range(len(a)):
			if a[i] != b[i] and (not (a[i] in s1 and b[i] in s1 or (a[i] in s2 and b[i] in s2))):
				return 0
		return 1
f = input().lower()
n = int(input())
s1 = set(['o', '0'])
s2 = set(['1', 'l', 'i'])
g = []
for i in range(n):
	g.append(input().lower())
for i in range(n):
	if check(f, g[i]):
		print('No')
		break
else:
	print('Yes')


def normalize(login):
	login = login.lower()
	login = login.replace('0', 'o')
	login = login.replace('1', 'l')
	login = login.replace('l', 'i')
	return login
user_login = normalize(input())
db_size = int(input())
logins = []
for i in range(db_size):
	logins.append(normalize(input()))
if user_login in logins:
	print('No')
else:
	print('Yes')


s = input()
n = int(input())
f = True
for i in range(n):
	password = input()
	if len(s) == len(password):
		f1 = False
		for j in range(len(s)):
			if not (s[j] == password[j] or ('a' <= s[j] <= 'z' and ord(password[j]) == ord(s[j]) - 32 or ('A' <= s[j] <= 'Z' and ord(password[j]) == ord(s[j]) + 32) or (s[j] in 'oO0' and password[j] in 'oO0') or (s[j] in '1lLIi' and password[j] in '1lLIi'))):
				f1 = True
				break
		if f1 == False:
			f = False
print('Yes' if f else 'No')


def standart(s):
	a = ''
	for i in s:
		if i == 'O' or i == 'o':
			a += '0'
		elif i == '1' or i == 'l' or i == 'I' or (i == 'i') or (i == 'L'):
			a += '1'
		elif i.isalpha():
			a += i.lower()
		else:
			a += i
	return a
a = standart(input())
n = int(input())
for i in range(n):
	s = input()
	if a == standart(s):
		print('No')
		exit(0)
print('Yes')


s = list(input())
n = int(input())
lst = []
for i in range(n):
	lst.append(list(input()))

def change(elem):
	if elem in {'1', 'i', 'I', 'l', 'L'}:
		elem = '['
	elif elem in {'0', 'o', 'O'}:
		elem = ']'
	else:
		elem = elem.upper()
	return elem

def check(one, two):
	if len(one) != len(two):
		return False
	for i in range(len(one)):
		one[i] = change(one[i])
		two[i] = change(two[i])
		if one[i] != two[i]:
			return False
	return True
flag = True
for i in range(n):
	if check(s, lst[i]):
		flag = False
		break
if flag:
	print('Yes')
else:
	print('No')


log = str(input())
log1 = ''
for i in range(0, len(log)):
	if log[i] == 'O' or log[i] == 'o':
		log1 += '0'
	elif log[i] == 'l' or log[i] == 'I' or log[i] == 'L' or (log[i] == 'i'):
		log1 += '1'
	else:
		log1 += log[i]
log1 = log1.lower()
n = int(input())
k = 0
for x in range(0, n):
	logt = ''
	log = str(input())
	for i in range(0, len(log)):
		if log[i] == 'O' or log[i] == 'o':
			logt += '0'
		elif log[i] == 'l' or log[i] == 'I' or log[i] == 'L' or (log[i] == 'i'):
			logt += '1'
		else:
			logt += log[i]
	logt = logt.lower()
	if logt == log1:
		k = 1
		break
if k == 1:
	print('No')
else:
	print('Yes')


def transform(s):
	return s.upper().replace('O', '0').replace('I', '1').replace('L', '1')
login = transform(input())
reserved = [transform(input()) for i in range(int(input()))]
print('No' if login in reserved else 'Yes')


s = input().lower()
n = int(input())
logins = []
for i in range(0, n):
	logins.append(input().lower())
norm_logins = []
norm_login = ''
for letter in s:
	if letter == '0':
		norm_login += 'o'
	elif letter == 'l' or letter == 'i':
		norm_login += '1'
	else:
		norm_login += letter
for login in logins:
	word = ''
	for letter in login:
		if letter == '0':
			word += 'o'
		elif letter == 'l' or letter == 'i':
			word += '1'
		else:
			word += letter
	norm_logins.append(word)
for login in norm_logins:
	flag = False
	if norm_login == login:
		print('No')
		flag = True
		break
if not flag:
	print('Yes')


def f(login1, login2):
	s1 = login1.lower()
	s2 = login2.lower()
	if len(login1) != len(login2):
		return False
	else:
		p = 0
		s = ''
		for i in range(len(login1)):
			if s1[i] == s2[i]:
				s = s + s1[i]
			if s1[i] == 'o' and s2[i] == '0' or (s2[i] == 'o' and s1[i] == '0'):
				s = s + 'o'
			if s2[i] == 'i' and s1[i] == 'l' or (s2[i] == 'l' and s1[i] == 'i'):
				s = s + '1'
			if s2[i] == '1' and s1[i] == 'l' or (s2[i] == '1' and s1[i] == 'i'):
				s = s + '1'
			if s2[i] == 'i' and s1[i] == '1' or (s2[i] == 'l' and s1[i] == '1'):
				s = s + '1'
	if len(s) == len(s1):
		return True
	else:
		return False
login = input()
n = int(input())
a = []
q = True
for i in range(n):
	new = input()
	if f(login, new):
		print('No')
		q = False
		break
if q:
	print('Yes')


def transformStr(s):
	return s.upper().replace('L', '1').replace('I', '1').replace('O', '0')
base = transformStr(input())
for _ in range(int(input())):
	if transformStr(input()) == base:
		print('No')
		break
else:
	print('Yes')


new_login = input().upper().replace('O', '0').replace('L', '1').replace('I', '1')
logins_count = int(input())
for i in range(logins_count):
	if new_login == input().upper().replace('O', '0').replace('L', '1').replace('I', '1'):
		print('No')
		exit()
print('Yes')


def norm(s):
	d = ord('A') - ord('a')
	s11 = ''
	for i in range(len(s)):
		if ord('a') <= ord(s[i]) <= ord('z'):
			s11 += chr(ord(s[i]) + d)
		else:
			s11 += s[i]
	s = s11
	s = s.replace('O', '0')
	s = s.replace('L', '1')
	s = s.replace('I', '1')
	return s
s = norm(input())
n = int(input())
ok = True
for i in range(n):
	s1 = input()
	if norm(s1) == s:
		ok = False
		break
if ok:
	print('Yes')
else:
	print('No')


start = input().lower().replace('o', '0').replace('l', '1').replace('i', '1')
rez = True
for i in range(int(input())):
	temp = input().lower().replace('o', '0').replace('l', '1').replace('i', '1')
	if temp == start:
		rez = False
print('Yes' if rez else 'No')


new_login = input()
count_login_db = int(input())
is_can = True
check_o = ['0', 'o', 'O']
check_i = ['1', 'i', 'I', 'L', 'l']

def check_letter(letter_db, letter_new):
	isO = letter_db in check_o and letter_new in check_o
	isI = letter_db in check_i and letter_new in check_i
	isUpper = letter_db.upper() == letter_new.upper()
	return isO or isI or isUpper
for i in range(count_login_db):
	check_login = input()
	if len(check_login) != len(new_login):
		continue
	if not is_can:
		break
	for (letter_db, letter_new) in zip(check_login, new_login):
		if check_letter(letter_db, letter_new):
			is_can = False
			continue
		else:
			is_can = True
			break
if is_can:
	print('Yes')
else:
	print('No')


d = {'o': '0', 'i': '1', 'l': '1'}

def g(c):
	if c in d:
		return d[c]
	return c

def f(s):
	r = list(map(g, s))
	return ''.join(r)
s = f(input().lower())
n = int(input())
strs = set()
for i in range(n):
	strs.add(f(input().lower()))
if s not in strs:
	print('Yes')
else:
	print('No')


def chCmp(ch, exCh):
	if ch == 'o' or ch == '0':
		if exCh == 'o' or exCh == '0':
			return True
	if ch == '1' or ch == 'l' or ch == 'i':
		if exCh == '1' or exCh == 'l' or exCh == 'i':
			return True
	return ch == exCh

def simCmp(login, exLogin):
	if len(login) != len(exLogin):
		return False
	for i in range(len(login)):
		if not chCmp(login[i], exLogin[i]):
			return False
	return True
login = input()
n = int(input())
isCan = True
for i in range(n):
	exLogin = input()
	if simCmp(login.lower(), exLogin.lower()):
		isCan = False
		break
print('Yes') if isCan else print('No')


s = input()
n = int(input())
d = dict()
d['i'] = ['l', 'L', '1', 'i', 'I']
d['I'] = ['l', 'L', '1', 'i', 'I']
d['1'] = ['l', 'L', '1', 'i', 'I']
d['l'] = ['l', 'L', '1', 'i', 'I']
d['L'] = ['l', 'L', '1', 'i', 'I']
d['o'] = ['o', 'O', '0']
d['O'] = ['o', 'O', '0']
d['0'] = ['o', 'O', '0']
t = 0
for i in range(n):
	a = input()
	p = 0
	if len(s) == len(a):
		for j in range(len(s)):
			count = 0
			if s[j] == a[j]:
				count = 1
			elif ord(s[j]) - ord('a') == ord(a[j]) - ord('A'):
				count = 1
			elif ord(s[j]) - ord('A') == ord(a[j]) - ord('a'):
				count = 1
			elif s[j] in d:
				if a[j] in d[s[j]]:
					count = 1
			if count == 1:
				p += 1
		if p == len(s):
			t = 1
if t == 1:
	print('No')
else:
	print('Yes')


def change(s):
	res = ''
	for i in range(len(s)):
		if s[i] == 'O' or s[i] == 'o':
			res += '0'
			continue
		if s[i] == 'l' or s[i] == 'L' or s[i] == 'i' or (s[i] == 'I'):
			res += '1'
			continue
		if s[i].isalpha() and s[i].isupper():
			res += s[i].lower()
			continue
		res += s[i]
	return res
a = change(input())
n = int(input())
for i in range(n):
	b = change(input())
	if a == b:
		print('No')
		return
print('Yes')


ss = input()
st = ''
for j in range(len(ss)):
	c = ss[j]
	if 'A' <= c <= 'Z':
		c = chr(ord(c) + ord('a') - ord('A'))
	if c == 'o':
		c = '0'
	if c == 'l' or c == 'i':
		c = '1'
	st += c
s = st
n = int(input())
for i in range(n):
	ss = input()
	st = ''
	for j in range(len(ss)):
		c = ss[j]
		if 'A' <= c <= 'Z':
			c = chr(ord(c) + ord('a') - ord('A'))
		if c == 'o':
			c = '0'
		if c == 'l' or c == 'i':
			c = '1'
		st += c
	if s == st:
		print('No')
		return
print('Yes')


def read():
	return list(map(int, input().split()))
s = input()
for i in range(len(s)):
	if s[i] == '0':
		s = s[:i] + 'o' + s[i + 1:]
	elif s[i] == '1' or s[i] == 'i' or s[i] == 'I':
		s = s[:i] + 'l' + s[i + 1:]
a = []
n = int(input())
for i in range(n):
	c = input()
	for i in range(len(c)):
		if c[i] == '0':
			c = c[:i] + 'o' + c[i + 1:]
		elif c[i] == '1' or c[i] == 'i' or c[i] == 'I':
			c = c[:i] + 'l' + c[i + 1:]
	if c.capitalize() == s.capitalize():
		print('No')
		exit()
print('Yes')


def low_rep(string):
	return string.lower().replace('o', '0').replace('l', '1').replace('i', '1')
login = low_rep(input())
n = int(input())
flag = False
for i in range(n):
	tmp = low_rep(input())
	if tmp == login:
		flag = True
if flag:
	print('No')
else:
	print('Yes')


login = input()
n = int(input())
listLogin = [''] * n
for i in range(n):
	listLogin[i] = input()
for i in range(n):
	for j in range(len(login)):
		word = listLogin[i]
		if len(login) != len(word):
			break
		elif login[j] in {'O', '0', 'o'} and word[j] in {'O', '0', 'o'}:
			continue
		elif login[j] in {'1', 'l', 'I', 'i', 'L'} and word[j] in {'1', 'l', 'I', 'i', 'L'}:
			continue
		elif login[j].upper() == word[j].upper():
			continue
		else:
			break
	else:
		print('No')
		break
else:
	print('Yes')


def replace(s):
	return s.upper().replace('O', '0').replace('I', '1').replace('L', '1')

def convert_answer(t):
	if t:
		return 'Yes'
	else:
		return 'No'

def find_similar(s, logins):
	database = set()
	for l in logins:
		new_l = replace(l)
		database.add(new_l)
	new_s = replace(s)
	return convert_answer(new_s not in database)
s = input()
length = int(input())
logins = []
for _ in range(length):
	logins.append(input())
print(find_similar(s, logins))


def normalize(login: str):
	return login.lower().replace('0', 'o').replace('i', 'l').replace('1', 'l')
wanted = normalize(input())
n = int(input())
for i in range(n):
	if normalize(input()) == wanted:
		print('No')
		exit(0)
print('Yes')


alpha = 'qwertyupasdfghjkzxcvbnmQWERTYUPASDFGHJKZXCVBNM'
alikes = []
for i in range(len(alpha)):
	alikes.append(set(alpha[i]))
	alikes[-1].add(alpha[(i + 23) % 46])
alikes.append(set(['0', 'o', 'O']))
alikes.append(set(['l', 'L', 'i', 'I', '1']))
for i in range(2, 10):
	alikes.append(set(str(i)))
alikes.append(set('_'))
a = input()
check = False
for i in range(int(input())):
	b = input()
	if len(a) != len(b) or check:
		continue
	for j in range(len(a)):
		newCheck = False
		for k in alikes:
			if a[j] in k:
				if b[j] not in k:
					newCheck = True
				break
		if newCheck:
			break
		check = j == len(a) - 1
print('No' if check else 'Yes')


import sys

def normalize(s):
	s = s.lower()
	s = s.replace('o', '0')
	s = s.replace('l', '1')
	s = s.replace('i', '1')
	return s
query = normalize(next(sys.stdin).strip())
n = int(next(sys.stdin).strip())
for line in sys.stdin:
	line = normalize(line.strip())
	if query == line:
		print('No')
		return
print('Yes')


t = input()

def make_str(s):
	new_s = s
	new_s = new_s.lower()
	new_s = new_s.replace('0', 'O')
	new_s = new_s.replace('1', 'l')
	new_s = new_s.replace('l', 'I')
	new_s = new_s.replace('1', 'I')
	new_s = new_s.lower()
	return new_s
t = make_str(t)
n = int(input())
for i in range(n):
	ee = make_str(input())
	if t == ee:
		print('No')
		exit()
print('Yes')


needle = input().strip().lower()
n = int(input())
current = []
for i in range(n):
	temp = input().strip().lower()
	current.append(temp)
import sys

def similar(s1, s2):
	if len(s1) != len(s2):
		return False
	l = set(['1', 'l', 'L', 'i', 'I'])
	o = set(['o', 'O', '0'])
	for i in range(len(s1)):
		if s1[i] == s2[i]:
			continue
		if s1[i] in l and s2[i] in l:
			continue
		if s1[i] in o and s2[i] in o:
			continue
		return False
	return True
for item in current:
	if similar(needle, item):
		print('No')
		sys.exit()
print('Yes')


from math import *
s = input()
n = int(input())
s = s.upper()
it = ''
for i in range(len(s)):
	if s[i] == 'L' or s[i] == 'I':
		it = it + '1'
	elif s[i] == 'O':
		it = it + '0'
	else:
		it = it + s[i]
for i in range(n):
	s2 = input()
	it2 = ''
	s2 = s2.upper()
	for i in range(len(s2)):
		if s2[i] == 'L' or s2[i] == 'I':
			it2 = it2 + '1'
		elif s2[i] == 'O':
			it2 = it2 + '0'
		else:
			it2 = it2 + s2[i]
	if it2 == it:
		print('No')
		exit()
print('Yes')


def modify(char):
	char = char.lower()
	if char in '0O':
		return 'o'
	if char in '1li':
		return '1'
	return char

def modify_word(word):
	return ''.join([modify(x) for x in word])

def can_reg(already_exists, login):
	already_exists = [modify_word(x) for x in already_exists]
	return modify_word(login) not in already_exists

def test():
	assert can_reg(['2_wat', 'wat_1'], '1_wat') == True
	assert can_reg(['00', 'ooA', 'oOo'], '000') == False
	assert can_reg(['__i_', '_1_', 'I'], '_i_') == False
	assert can_reg(['2a0', 'La1', '1a0'], 'La0') == False
	assert can_reg(['aBc'], 'abc') == False
	assert can_reg(['LIL0', '0Ril'], '0Lil')
	assert can_reg([], '1') == True
	assert can_reg(['1', 'l'], 'i') == False
	assert can_reg(['1', 'l'], '0') == True

def run():
	login = input()
	n = int(input())
	already_exists = [input() for _ in range(n)]
	print('Yes') if can_reg(already_exists, login) else print('No')
run()


s = input()
n = int(input())
o0 = ['o', '0', 'O']
l1 = ['1', 'l', 'L', 'i', 'I']
no = 0
k = 0
for i in range(n):
	l = input()
	if len(s) == len(l):
		for i in range(len(l)):
			if s[i].upper() == l[i].upper() or (s[i] in o0 and l[i] in o0) or (s[i] in l1 and l[i] in l1):
				k += 1
			if k == len(s):
				no += 1
		k = 0
if no == 0:
	print('Yes')
else:
	print('No')


newLogin = input()
n = int(input())
ans = True
for i in range(n):
	oldLogin = input()
	if len(newLogin) != len(oldLogin):
		continue
	count = 0
	for j in range(len(newLogin)):
		if newLogin[j] in '0oO':
			if oldLogin[j] not in '0oO':
				break
		elif newLogin[j] in '1lLIi':
			if oldLogin[j] not in '1lLIi':
				break
		elif oldLogin[j].lower() != newLogin[j] and oldLogin[j].upper() != newLogin[j]:
			break
		count += 1
	if count == len(newLogin):
		ans = False
if ans:
	print('Yes')
else:
	print('No')


def decode(string):
	return string.lower().replace('0', 'o').replace('1', 'l').replace('', 'l').replace('I', 'l').replace('i', 'l')
ori = decode(str(input()))
n = int(input())
for _ in range(n):
	c = decode(str(input()))
	if c == ori:
		print('No')
		exit()
print('Yes')


s = input()
n = int(input())
b = False
for i in range(n):
	col = 0
	s1 = input()
	if len(s1) == len(s):
		for i in range(len(s1)):
			if s1[i].upper() == s[i].upper():
				col += 1
			if s1[i].upper() == 'O' and s[i] == '0':
				col += 1
			if s1[i] == '0' and s[i].upper() == 'O':
				col += 1
			if s1[i].upper() == 'I' and s[i] == '1':
				col += 1
			if s1[i].upper() == 'L' and s[i] == '1':
				col += 1
			if s1[i] == '1' and s[i].upper() == 'I':
				col += 1
			if s1[i] == '1' and s[i].upper() == 'L':
				col += 1
			if s1[i].upper() == 'L' and s[i].upper() == 'I':
				col += 1
			if s1[i].upper() == 'I' and s[i].upper() == 'L':
				col += 1
		if col == len(s1):
			b = True
			break
if b:
	print('No')
else:
	print('Yes')


def readline():
	return input()

def normalize_word(word):
	word = list(word)
	for ind in range(0, len(word)):
		if word[ind] in ('O', 'o'):
			word[ind] = '0'
		elif word[ind] in ('L', 'l', 'I', 'i'):
			word[ind] = '1'
		else:
			word[ind] = word[ind].lower()
	return ''.join(word)

def read_words():
	target = normalize_word(readline())
	amount = int(readline())
	bag_of_words = set()
	for _ in range(0, amount):
		word = normalize_word(readline())
		bag_of_words.add(word)
	print('No' if target in bag_of_words else 'Yes')
read_words()


import sys

def stand(s):
	s = s.lower()
	s = s.replace('0', 'o')
	s = s.replace('1', 'i')
	s = s.replace('l', 'i')
	return s
s = input()
n = int(input())
t = []
for i in range(n):
	t.append(input())
s = stand(s)
for i in t:
	i = stand(i)
	if i == s:
		print('No')
		sys.exit()
print('Yes')


new_login = input()
new_login = new_login.upper()
n = int(input())
old_login = []
mn1 = {'1', 'I', 'L'}
mn2 = {'0', 'O'}
for i in range(n):
	old_login.append(input())
index = 0
for i in range(n):
	if len(new_login) == len(old_login[i]):
		old_login[i] = old_login[i].upper()
		index2 = 1
		for j in range(len(new_login)):
			if not (old_login[i][j] == new_login[j] or (old_login[i][j] in mn1 and new_login[j] in mn1) or (old_login[i][j] in mn2 and new_login[j] in mn2)):
				index2 = 0
				break
		if index2 == 1:
			index = 1
if index == 0:
	print('Yes')
else:
	print('No')


def corrector(w, p):
	if w.upper() == p or w.lower() == p:
		return 'OK'
	mas_0 = ['0', 'O', 'o']
	if w in mas_0 and p in mas_0:
		return 'OK'
	mas_1 = ['1', 'L', 'l', 'I', 'i']
	if w in mas_1 and p in mas_1:
		return 'OK'
	return 'NOT'

def progress(present, wish):
	position = 0
	while position < len(present):
		w = wish[position]
		p = present[position]
		ans = corrector(w, p)
		if ans == 'NOT':
			return 1
		position += 1
	return 0

def main():
	wish = str(input())
	kol = int(input())
	for i in range(kol):
		present = str(input())
		if present == wish:
			print('No')
			return 0
		if len(present) == len(wish):
			if progress(present, wish) == 0:
				print('No')
				return 0
		else:
			continue
	print('Yes')
main()


s = input()
n = int(input())
logins = []
for i in range(n):
	a = input()
	if len(a) == len(s):
		logins.append(a)
del a
mn1 = set('1iIlL')
mn2 = set('0oO')
for current_log in logins:
	for sym in range(len(current_log)):
		if s[sym] == current_log[sym]:
			continue
		elif s[sym].lower() == current_log[sym] or s[sym].upper() == current_log[sym]:
			continue
		elif s[sym] in mn2 and current_log[sym] in mn2:
			continue
		elif s[sym] in mn1 and current_log[sym] in mn1:
			continue
		else:
			break
	else:
		print('No')
		exit()
print('Yes')


s = input().upper().replace('O', '0').replace('1', 'I').replace('L', 'I')
n = int(input())
for _ in range(n):
	if input().upper().replace('O', '0').replace('1', 'I').replace('L', 'I') == s:
		print('No')
		exit()
print('Yes')


true = list(input())
n = int(input())
lst = []
for i in range(n):
	z = list(input())
	lst.append(z)
	for j in range(len(z)):
		if 96 < ord(z[j]) < 123:
			z[j] = chr(ord(z[j]) - 32)
		if z[j] == '0':
			z[j] = 'O'
		if z[j] == '1' or z[j] == 'L' or z[j] == 'l' or (z[j] == 'I') or (z[j] == 'i'):
			z[j] = 'L'
for i in range(len(true)):
	if 96 < ord(true[i]) < 123:
		true[i] = chr(ord(true[i]) - 32)
	if true[i] == '0':
		true[i] = 'O'
	if true[i] == '1' or true[i] == 'L' or true[i] == 'l' or (true[i] == 'I') or (true[i] == 'i'):
		true[i] = 'L'
s = 0
for i in lst:
	if ''.join(i) == ''.join(true):
		s += 1
if s == 0:
	print('Yes')
else:
	print('No')


login = input()
n = int(input())

def check(log1, log2):
	if len(log1) != len(log2):
		return False
	a1 = ['i', 'I', '1', 'l', 'L']
	a2 = ['o', '0', 'O']
	for i in range(len(log1)):
		bool_log1_in_a1 = log1[i] in a1
		bool_log1_not_in_a1 = not bool_log1_in_a1
		bool_log2_in_a1 = log2[i] in a1
		bool_log2_not_in_a1 = not bool_log2_in_a1
		bool_log1_in_a2 = log1[i] in a2
		bool_log1_not_in_a2 = not bool_log1_in_a2
		bool_log2_in_a2 = log2[i] in a2
		bool_log2_not_in_a2 = not bool_log2_in_a2
		if bool_log1_in_a1 and bool_log2_not_in_a1 or (bool_log1_not_in_a1 and bool_log2_in_a1):
			return False
		elif bool_log1_in_a2 and bool_log2_not_in_a2 or (bool_log1_not_in_a2 and bool_log2_in_a2):
			return False
		elif log1[i].lower() != log2[i].lower() and bool_log1_not_in_a1 and bool_log1_not_in_a2 and bool_log2_not_in_a1 and bool_log2_not_in_a2:
			return False
	return True
flag = False
for i in range(n):
	login_2 = input()
	if check(login, login_2):
		flag = True
if flag:
	print('No')
else:
	print('Yes')


s = str(input().lower())
n = int(input())
z = 'Yes'
for i in range(0, n):
	t = str(input().lower())
	m = 0
	for j in range(0, len(t)):
		if len(t) != len(s):
			m = 1
		elif t[j] != s[j]:
			if t[j] not in ['0', 'o'] or s[j] not in ['0', 'o']:
				if t[j] not in ['1', 'i', 'l'] or s[j] not in ['1', 'i', 'l']:
					m = 1
	if m == 0:
		z = 'No'
print(z)


def check(inp: str, log: str):
	return inp == log

def equalsO(let: str):
	return let == 'O' or let == '0'

def equalsI(let: str):
	return let == '1' or let == 'L' or let == 'I'

def main():
	logins = []
	inputs = input()
	r = int(input())
	for _ in range(r):
		logins.append(input())
	inputs = inputs.upper()
	eq = True
	for word in logins:
		j = 0
		word = word.upper()
		if len(word) < len(inputs) or len(word) > len(inputs):
			continue
		elif len(word) == len(inputs):
			for i in word:
				w = inputs[j]
				j += 1
				if i == w:
					eq = True
					continue
				elif equalsO(w) and equalsO(i):
					eq = True
					continue
				elif equalsI(w) and equalsI(i):
					eq = True
					continue
				eq = False
				break
		if eq:
			print('No')
			exit()
	print('Yes')
	exit()
main()


def check(ch1, ch2):
	return check1(ch1, ch2) or check2(ch1, ch2) or check3(ch1, ch2) or check4(ch1, ch2)

def check1(ch1, ch2):
	return ch1 == ch2.lower() or ch2 == ch1.lower()

def check2(ch1, ch2):
	return ch1 == '0' and (ch2 == 'o' or ch2 == 'O') or (ch2 == '0' and (ch1 == 'o' or ch1 == 'O'))

def check3(ch1, ch2):
	return ch1.lower() == 'i' and (ch2.lower() == 'l' or ch2 == '1') or (ch2.lower() == 'i' and (ch1.lower() == 'l' or ch1 == '1'))

def check4(ch1, ch2):
	return ch1.lower() == 'l' and (ch2.lower() == 'i' or ch2 == '1') or (ch2.lower() == 'l' and (ch1.lower() == 'i' or ch1 == '1'))
s = input()
l = len(s)
n = int(input())
f = False
for i in range(n):
	s1 = input()
	dif = 0
	pd = 0
	if len(s1) == l:
		for j in range(l):
			if s[j] != s1[j]:
				dif += 1
				if check(s[j], s1[j]):
					pd += 1
		if dif == pd:
			f = True
if f:
	print('No')
else:
	print('Yes')


gl = input()
vidO = ['o', '0']
vid1 = ['1', 'i', 'l']
dli = len(gl)
kol = int(input())
vselog = []
res = 1
kek = 0
for i in range(kol):
	dob = input()
	if len(dob) == dli:
		vselog.append(dob)
for i in vselog:
	kek = 0
	for j in range(dli):
		provA = gl[j].lower()
		provB = i[j].lower()
		if provA == provB or (provA in vidO and provB in vidO) or (provA in vid1 and provB in vid1):
			kek += 1
			continue
		else:
			continue
	if kek == dli:
		print('No')
		res = 0
		break
	elif res == 0:
		break
if res == 1:
	print('Yes')


s = input()
n = int(input())
for i in range(n):
	t = input()
	if len(s) != len(t):
		continue
	for j in range(len(t)):
		if t[j].lower() == s[j].lower():
			continue
		if t[j] in '0Oo' and s[j] in '0Oo':
			continue
		if s[j] in '1lILi' and t[j] in '1lILi':
			continue
		break
	else:
		print('No')
		exit(0)
print('Yes')


def reorg(r):
	r = r.replace('O', '0')
	r = r.replace('l', '1')
	r = r.replace('I', '1')
	r = r.replace('o', '0')
	r = r.replace('L', '1')
	r = r.replace('i', '1')
	r = r.lower()
	return r
s = input()
n = int(input())
v = True
for i in range(n):
	s1 = input()
	if reorg(s) == reorg(s1):
		v = False
		break
if v:
	print('Yes')
else:
	print('No')


def change(s):
	s = s.lower()
	s = s.replace('o', '0')
	s = s.replace('l', '1')
	s = s.replace('i', '1')
	return s
log = change(input())
num = int(input())
logins = []
for i in range(0, num):
	logins.append(change(input()))
if log in logins:
	print('No')
else:
	print('Yes')


new_login = input()
n = int(input())
output = 'Yes'
for i in range(n):
	iseqvivalent = True
	old_login = input()
	if len(new_login) == len(old_login):
		for j in range(len(new_login)):
			a = new_login[j].lower()
			b = old_login[j].lower()
			if not (a == b or (a == '0' and b == 'o') or (a == 'o' and b == '0') or ((a == '1' or a == 'l' or a == 'i') and (b == '1' or b == 'l' or b == 'i'))):
				iseqvivalent = False
				break
		if iseqvivalent:
			output = 'No'
print(output)


initial = input()
can_print = True

def normalize(input):
	result = input.lower()
	result = result.replace('i', '1')
	result = result.replace('l', '1')
	result = result.replace('o', '0')
	return result
norm = normalize(initial)
number_of_lines = input()
for i in range(0, int(number_of_lines)):
	newLine = input()
	if normalize(newLine) == norm:
		can_print = False
if can_print:
	print('Yes')
else:
	print('No')


def f(s):
	ans = ''
	for i in s:
		if i == 'l' or i == 'L' or i == 'i' or (i == 'I'):
			ans += '1'
		elif 'a' <= i <= 'z':
			ans += i.upper()
		elif i == '0':
			ans += 'O'
		else:
			ans += i
	return ans
s = input()
s = f(s)
n = int(input())
a = []
for i in range(n):
	ss = input()
	a.append(f(ss))
if s in a:
	print('No')
else:
	print('Yes')


import sys
equiv = {'o': 1, 'O': 1, '0': 1, '1': 2, 'l': 2, 'L': 2, 'i': 2, 'I': 2}

def compare(c1, c2):
	if ord(c1) > ord(c2):
		(c1, c2) = (c2, c1)
	(e1, e2) = (equiv.get(c1, 0), equiv.get(c2, 0))
	if e1 and e2 and (e1 == e2):
		return True
	if 'A' <= c1 <= 'Z' and chr(ord(c1) - ord('A') + ord('a')) == c2:
		return True
	return c1 == c2

def cmps(s1, s2):
	if len(s1) != len(s2):
		return False
	for (c1, c2) in zip(s1, s2):
		if not compare(c1, c2):
			return False
	return True
s = input()
n = int(input())
for _ in range(n):
	s_i = input()
	if cmps(s_i, s):
		print('No')
		return
print('Yes')


def normalize(login):
	login = login.lower()
	login = login.replace('0', 'o').replace('1', 'l').replace('i', 'l')
	return login

def read_login():
	login = input()
	return normalize(login)
new_login = read_login()
n = int(input())
for _ in range(n):
	login = read_login()
	if login == new_login:
		print('No')
		exit(0)
print('Yes')


(s, n, array) = (input(), int(input()), [])
s = s.lower()
a1 = s.count('o')
a2 = s.count('l')
a3 = s.count('i')
for i in range(a1):
	s = s.replace('o', '0')
for i in range(a2):
	s = s.replace('l', '1')
for i in range(a3):
	s = s.replace('i', '1')
for i in range(n):
	s1 = input()
	s1 = s1.lower()
	array.append(s1)
for i in range(n):
	a1 = array[i].count('o')
	a2 = array[i].count('l')
	a3 = array[i].count('i')
	for k in range(a1):
		array[i] = array[i].replace('o', '0')
	for k in range(a2):
		array[i] = array[i].replace('l', '1')
	for k in range(a3):
		array[i] = array[i].replace('i', '1')
	if s == array[i]:
		print('No')
		exit(0)
print('Yes')


a = input()
a = a.lower()
a = a.replace('i', '1')
a = a.replace('l', '1')
a = a.replace('o', '0')
logins = []
for _ in range(int(input())):
	b = input()
	b = b.lower()
	b = b.replace('i', '1')
	b = b.replace('l', '1')
	b = b.replace('o', '0')
	logins.append(b)
print(['Yes', 'No'][a in logins])


def unify_login(login):
	login = login.lower()
	login = login.replace('0', 'o')
	login = login.replace('l', '1')
	login = login.replace('i', '1')
	return login
s = unify_login(input())
n = int(input())
logins = set()
for i in range(n):
	logins.add(unify_login(input()))
if s in logins:
	print('No')
else:
	print('Yes')


user = input()
user = user.upper()
user = user.replace('O', '0')
user = user.replace('L', '1')
user = user.replace('I', '1')
n = int(input())
a = []
for i in range(n):
	a.append(input())
f = True
for login in a:
	login = login.upper()
	login = login.replace('O', '0')
	login = login.replace('L', '1')
	login = login.replace('I', '1')
	if user == login:
		f = False
if f:
	print('Yes')
else:
	print('No')


s = str(input())
n = int(input())
found = False
for i in range(n):
	a = str(input())
	if len(a) == len(s):
		similar = True
		for j in range(len(a)):
			ac = a[j].capitalize()
			sc = s[j].capitalize()
			if ac != sc:
				if ac in ('0', 'O') and sc in ('0', 'O') or (ac in ('1', 'I', 'L') and sc in ('1', 'I', 'L')):
					similar = True
				else:
					similar = False
					break
		if similar:
			found = True
if found:
	print('No')
else:
	print('Yes')


def format(s):
	log = [i for i in s.lower()]
	for i in range(len(log)):
		if log[i] == 'i' or log[i] == 'l':
			log[i] = '1'
		if log[i] == 'o':
			log[i] = '0'
	return log
log = format(input())
n = int(input())
r = 0
for i in range(n):
	if format(input()) == log:
		r = 1
if r:
	print('No')
else:
	print('Yes')


def simplify(name):
	return name.lower().replace('0', 'o').replace('1', 'i').replace('l', 'i')
s = simplify(input())
ans = 'Yes'
for i in range(int(input())):
	if simplify(input()) == s:
		ans = 'No'
print(ans)


def transform(log):
	return log.replace('O', '0').replace('o', '0').replace('l', '1').replace('I', '1').replace('L', '1').replace('i', '1').lower()
login = transform(input())
n = int(input())
logins = []
check = False
for i in range(n):
	if login == transform(input()):
		print('No')
		check = True
if not check:
	print('Yes')


need = input()
n = int(input())
lst = []
for i in range(n):
	lst.append(input())
need = need.lower()
need = need.replace('o', '0')
need = need.replace('l', '1')
need = need.replace('i', '1')
for i in range(n):
	lst[i] = lst[i].lower()
	lst[i] = lst[i].replace('o', '0')
	lst[i] = lst[i].replace('l', '1')
	lst[i] = lst[i].replace('i', '1')
ans = False
for elem in lst:
	ans |= need == elem
if not ans:
	print('Yes')
else:
	print('No')


import re, sys

def run():
	global pattern, logins
	for log in logins:
		if len(login) != len(log):
			continue
		if re.match(pattern, log):
			return 'No'
	return 'Yes'
pattern = ''
login = input().upper()
count = int(input())
logins = []
i = ['I', 'L', '1']
for a in range(count):
	logins.append(input().upper())
for char in login:
	if char == '0' or char == 'O':
		char = '[0O]'
	elif char in i:
		char = '[IL1]'
	pattern += char
print(run())


def normalize(s):
	res = []
	for c in s.lower():
		if c == 'i' or c == 'l':
			res.append('1')
		elif c == 'o':
			res.append('0')
		else:
			res.append(c)
	return ''.join(res)
s = normalize(input().strip())
n = int(input())
for i in range(n):
	s2 = normalize(input().strip())
	if s == s2:
		print('No')
		break
else:
	print('Yes')


log = input()
log = log.lower()
log = log.replace('0', 'o')
log = log.replace('i', '1')
log = log.replace('l', '1')
a = int(input())
logs = set()
for i in range(a):
	s = input()
	s = s.lower()
	s = s.replace('0', 'o')
	s = s.replace('i', '1')
	s = s.replace('l', '1')
	logs.add(s)
if log in logs:
	print('No')
else:
	print('Yes')


def norm(s):
	return s.lower().replace('o', '0').replace('i', '1').replace('l', '1')
s = norm(input())
for i in range(int(input())):
	if norm(input()) == s:
		print('No')
		break
else:
	print('Yes')


def f(s, t):
	s = s.lower()
	t = t.lower()
	if len(s) != len(t):
		return True
	for i in range(len(s)):
		if s[i] != t[i]:
			w = [s[i], t[i]]
			w.sort()
			if w != sorted(['o', '0']) and w != sorted(['i', 'l']) and (w != sorted(['i', '1'])) and (w != sorted(['l', '1'])):
				return True
	return False
s = input()
n = int(input())
q = True
for i in range(n):
	t = input()
	q = q and f(s, t)
if q:
	print('Yes')
else:
	print('No')


def normalize_login(login):
	return login.lower().replace('o', '0').replace('i', '1').replace('l', '1')
new_login = normalize_login(input())
n = int(input())
logins = []
for i in range(0, n):
	login = normalize_login(input())
	logins.append(login)
print('No' if new_login in logins else 'Yes')


def convert(y):
	ar = []
	s = ''
	for j in y:
		ar.append(j)
	for k in range(0, len(ar)):
		if ar[k] == 'I' or ar[k] == 'l' or ar[k] == 'i' or (ar[k] == 'L'):
			ar[k] = '1'
		elif ar[k] == 'O' or ar[k] == 'o':
			ar[k] = '0'
	d = s.join(ar)
	return d
x = input()
x = convert(x)
x = x.lower()
s = 0
n = int(input())
for i in range(0, n):
	y = input()
	y = convert(y)
	d = y.lower()
	if x == d:
		s = s + 1
		break
if s == 1:
	print('No')
else:
	print('Yes')


q1 = set(['0', 'O'])
q2 = set(['1', 'L', 'I'])

def qw(_s):
	_s = _s.upper()
	s = ''
	for e in _s:
		if e in q1:
			s += '0'
		elif e in q2:
			s += '1'
		else:
			s += e
	return s
_s = input()
n = int(input())
s = qw(_s)
bb = True
for i in range(n):
	_t = input()
	t = qw(_t)
	if s == t:
		bb = False
		break
print('Yes' if bb else 'No')


x = input()
n = int(input())
a = []
b = []
fin = True
verify = 0
count = -1
for i in range(n):
	a.append(input())
	b.append(0)
for i in x:
	count += 1
	for j in range(len(a)):
		if len(x) == len(a[j]):
			if ord(a[j][count]) == ord(i) + 32 or ord(a[j][count]) + 32 == ord(i):
				b[j] += 1
			else:
				if a[j][count] == '0' and (i == 'O' or i == 'o') or (a[j][count] == 'O' and (i == '0' or i == 'o')) or (a[j][count] == 'o' and (i == 'O' or i == '0')):
					b[j] += 1
				if a[j][count] == '1' and (i == 'l' or i == 'I' or i == 'i' or (i == 'L')) or (a[j][count] == 'l' and (i == '1' or i == 'I' or i == 'i' or (i == 'L'))) or (a[j][count] == 'I' and (i == '1' or i == 'l' or i == 'i' or (i == 'L'))) or (a[j][count] == 'i' and (i == 'I' or i == '1' or i == 'l' or (i == 'L'))) or (a[j][count] == 'L' and (i == 'I' or i == '1' or i == 'l' or (i == 'i'))):
					b[j] += 1
				if a[j][count] == i:
					b[j] += 1
for i in range(len(b)):
	if b[i] == len(x):
		fin = False
		break
if fin == True:
	print('Yes')
else:
	print('No')


def check(s, t):
	cnt = 0
	a1 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
	a2 = 'abcdefghijklmnopqrstuvwxyz'
	if len(s) != len(t):
		return False
	for i in range(len(s)):
		s1 = set(s[i])
		t1 = set(t[i])
		for elem in s1.copy():
			if elem in a1:
				s1.add(a2[a1.index(elem)])
			elif elem in a2:
				s1.add(a1[a2.index(elem)])
		for elem in t1.copy():
			if elem in a1:
				t1.add(a2[a1.index(elem)])
			elif elem in a2:
				t1.add(a1[a2.index(elem)])
		if 'O' in s1:
			s1.add('0')
		if '0' in s1:
			s1.add('O')
		if 'O' in t1:
			t1.add('0')
		if '0' in t1:
			t1.add('O')
		for elem in s1.copy():
			if elem in a1:
				s1.add(a2[a1.index(elem)])
			elif elem in a2:
				s1.add(a1[a2.index(elem)])
		for elem in t1.copy():
			if elem in a1:
				t1.add(a2[a1.index(elem)])
			elif elem in a2:
				t1.add(a1[a2.index(elem)])
		for e in '1li':
			if e in s1:
				s1.add('1')
				s1.add('l')
				s1.add('i')
			if e in t1:
				t1.add('1')
				t1.add('l')
				t1.add('i')
		for elem in s1.copy():
			if elem in a1:
				s1.add(a2[a1.index(elem)])
			elif elem in a2:
				s1.add(a1[a2.index(elem)])
		for elem in t1.copy():
			if elem in a1:
				t1.add(a2[a1.index(elem)])
			elif elem in a2:
				t1.add(a1[a2.index(elem)])
		if len(s1 & t1):
			cnt += 1
	return cnt == len(s)
s = input()
f = False
for i in range(int(input())):
	f |= check(s, input())
if f:
	print('No')
else:
	print('Yes')


def are_same(a, b):
	a = a.lower()
	b = b.lower()
	if a == b:
		return True
	if a in {'o', '0'}:
		return b in {'o', '0'}
	if a in {'1', 'l', 'i'}:
		return b in {'1', 'l', 'i'}

def main():
	s = input()
	n = int(input())
	for _ in range(n):
		s1 = input()
		if len(s1) == len(s) and all((are_same(x1, x2) for (x1, x2) in zip(s, s1))):
			print('No')
			return
	print('Yes')
main()


string = input()
string = string.lower()
string = string.replace('o', '0')
string = string.replace('l', '1')
string = string.replace('i', '1')
N = int(input())
pas = 1
for i in range(N):
	if pas == 1:
		s = input().lower()
		s = s.replace('o', '0')
		s = s.replace('l', '1')
		s = s.replace('i', '1')
		if string == s:
			pas = 0
if pas == 1:
	print('Yes')
else:
	print('No')


original = input()
num = int(input())

def check(s1, s2):
	s1 = s1.lower()
	s2 = s2.lower()
	if s1 == s2:
		return True
	s1 = s1.replace('o', '0')
	s2 = s2.replace('o', '0')
	if s1 == s2:
		return True
	s1 = s1.replace('i', '1').replace('l', '1')
	s2 = s2.replace('i', '1').replace('l', '1')
	if s1 == s2:
		return True
	return False
for _ in range(num):
	s = input()
	if check(s, original):
		print('No')
		break
else:
	print('Yes')


a = []
shet = 0
i = 0
log = str(input())
kol = int(input())
len_log = len(log)
log = log.lower()
log = log.replace('0', 'o')
log = log.replace('1', 'i')
log = log.replace('l', 'i')
while i < kol:
	a = str(input())
	a = a.lower()
	a = a.replace('0', 'o')
	a = a.replace('l', 'i')
	a = a.replace('1', 'i')
	if log == a:
		shet += 1
	else:
		shet += 0
	i += 1
if shet > 0:
	print('No')
else:
	print('Yes')


def get(s, t):
	if len(s) != len(t):
		return False
	s = s.upper()
	t = t.upper()
	S1 = {'O', '0'}
	S2 = {'1', 'I', 'L'}
	for i in range(len(s)):
		if not (s[i].lower() == t[i].lower() or (s[i] in S1 and t[i] in S1) or (s[i] in S2 and t[i] in S2)):
			return False
	return True
s = input()
n = int(input())
res = 'Yes'
for i in range(n):
	if get(s, input()):
		res = 'No'
		break
print(res)


def form(s):
	s = s.lower()
	s = s.replace('l', '1')
	s = s.replace('i', '1')
	s = s.replace('0', 'o')
	return s
import sys
l = sys.stdin.readline()
l = form(l)
n = int(sys.stdin.readline())
ps = []
for i in range(n):
	ps.append(form(sys.stdin.readline()))
if l in ps:
	sys.stdout.write('No')
else:
	sys.stdout.write('Yes')


s = input()
n = int(input())
array = [str(input()) for c in range(n)]
for c in range(len(array)):
	b = 0
	for b in range(len(array[c])):
		if array[c][b] == '0':
			array[c] = array[c][:b] + 'o' + array[c][b + 1:]
		elif array[c][b] == 'l' or array[c][b] == 'L' or array[c][b] == 'i' or (array[c][b] == 'I'):
			array[c] = array[c][:b] + '1' + array[c][b + 1:]
		elif array[c][b].isupper():
			array[c] = array[c][:b] + chr(ord(array[c][b]) + 32) + array[c][b + 1:]
for b in range(len(s)):
	if s[b] == '0':
		s = s[:b] + 'o' + s[b + 1:]
	elif s[b] == 'l' or s[b] == 'L' or s[b] == 'i' or (s[b] == 'I'):
		s = s[:b] + '1' + s[b + 1:]
	elif s[b].isupper():
		s = s[:b] + chr(ord(s[b]) + 32) + s[b + 1:]
if s in array:
	print('No')
else:
	print('Yes')


user_login = input()
count = int(input())
logins = []
for i in range(count):
	logins.append(input())
suspicion = True
for login in logins:
	suspicion = True
	if len(login) != len(user_login):
		suspicion = False
		continue
	for i in range(len(login)):
		if login[i] == user_login[i]:
			continue
		elif login[i].lower() == user_login[i] or login[i].upper() == user_login[i]:
			continue
		elif login[i] in ['0', 'O', 'o'] and user_login[i] in ['0', 'O', 'o']:
			continue
		elif login[i] in ['1', 'I', 'i', 'L', 'l'] and user_login[i] in ['1', 'I', 'i', 'L', 'l']:
			continue
		else:
			suspicion = False
			break
	if suspicion is True:
		break
if suspicion is True:
	print('No')
else:
	print('Yes')


s = input().lower()
l = len(s)
n = int(input())

def similarChar(a, b):
	zero = ('0', 'o')
	one = ('1', 'l', 'i')
	return a == b or (a in zero and b in zero) or (a in one and b in one)
for _ in range(n):
	t = input().lower()
	if len(t) != l:
		continue
	for i in range(l):
		if not similarChar(s[i], t[i]):
			break
	else:
		print('No')
		break
else:
	print('Yes')


def xxx(string: str):
	ss = string
	ss = ss.lower()
	ss = ss.replace('i', '1')
	ss = ss.replace('l', '1')
	ss = ss.replace('o', '0')
	return ss
s = input()
s = xxx(s)
x = len(s)
n = int(input())
res = True
for i in range(n):
	ss = input()
	if len(ss) == x:
		if xxx(ss) == s:
			res = False
			break
if res:
	print('Yes')
else:
	print('No')


def replace_letters(x):
	x = x.replace('0', 'O')
	x = x.replace('I', '1')
	x = x.replace('l', '1')
	x = x.replace('i', '1')
	x = x.replace('L', '1')
	return x
s = input()
n = int(input())
a = True
for i in range(n):
	t = input()
	if len(s) != len(t):
		continue
	t = replace_letters(t)
	s = replace_letters(s)
	if s.upper() == t.upper():
		a = False
		print('No')
		break
if a:
	print('Yes')


login = input()
n = int(input())

def is_similar(l, l2):
	g1 = 'O0o'
	g2 = 'lI1Li'
	if len(l) != len(l2):
		return False
	for i in range(len(l)):
		if l[i].lower() != l2[i].lower() and (not (l[i] in g1 and l2[i] in g1)) and (not (l[i] in g2 and l2[i] in g2)):
			return False
	return True
flag = True
for _ in range(n):
	login2 = input()
	if is_similar(login, login2):
		flag = False
		break
print('Yes' if flag else 'No')


def f():
	return input().lower().replace('0', 'o').replace('1', 'l').replace('i', 'l')
a = f()
n = int(input())
ok = True
for i in range(n):
	if f() == a:
		ok = False
if ok:
	print('Yes')
else:
	print('No')


def isBad(c1, c2):
	if c1 in ['o', '0'] and c2 in ['0', 'o']:
		return True
	if c1 in ['1', 'l', 'i'] and c2 in ['1', 'l', 'i']:
		return True
	if c1 == c2.lower() or c2 == c1.lower():
		return True
	return False

def isSim(s1, s2):
	if len(s1) != len(s2):
		return False
	cnt = 0
	bad = 0
	for i in range(len(s1)):
		if s1[i] != s2[i]:
			cnt += 1
			if isBad(s1[i].lower(), s2[i].lower()):
				bad += 1
	return cnt == bad
login = input()
n = int(input())
for i in range(n):
	l = input()
	if isSim(l, login):
		print('No')
		exit()
print('Yes')


def main():
	s = input()
	n = int(input())
	b = ['I', '1', 'l', 'L', 'i']
	c = ['0', 'o', 'O']
	for i in range(n):
		d = input()
		if len(d) != len(s):
			continue
		for j in range(len(s)):
			if d[j].lower() == s[j].lower():
				continue
			if d[j] in b and s[j] in b:
				continue
			if d[j] in c and s[j] in c:
				continue
			break
		else:
			print('No')
			return
	print('Yes')
main()


d = {'O': ['0'], '0': ['O'], '1': ['L', 'I'], 'L': ['1', 'I'], 'I': ['1', 'L']}
s = input().upper()
f = False
for _ in range(int(input())):
	m = input().upper()
	if len(m) == len(s):
		for i in range(len(s)):
			if s[i] == m[i] or (m[i] in d and s[i] in d[m[i]]):
				f = True
			else:
				f = False
				break
	if f:
		break
if not f:
	print('Yes')
else:
	print('No')


def new_login_check():
	new_login = input()
	n = input()
	counter = 0
	while counter < int(n):
		inp = input()
		new_login = new_login + ' ' + inp
		counter += 1
	logins = new_login.split(' ')
	logins_format = ''
	for element in logins:
		for i in element:
			if i == 'O' or i == 'o':
				i = '0'
			elif i == 'I' or i == 'L' or i == 'l' or (i == 'i'):
				i = '1'
			logins_format = logins_format + i
		logins_format = logins_format + ' '
	new_logins = logins_format[:len(logins_format) - 1].split(' ')
	counter = 1
	output = ''
	while counter <= int(n):
		if new_logins[0].lower() == new_logins[counter].lower():
			output = 'No'
			break
		else:
			output = 'Yes'
		counter += 1
	return output
test = new_login_check()
print(test)


s = input().lower()
n = int(input())
flag = False
c1 = ['o', '0']
c2 = ['1', 'l', 'i']
for i in range(n):
	cur = input().lower()
	works = True
	if len(cur) != len(s):
		continue
	for i in range(len(s)):
		if s[i] == cur[i] or (s[i] in c1 and cur[i] in c1) or (s[i] in c2 and cur[i] in c2):
			pass
		else:
			works = False
			break
	if works:
		flag = True
		break
if flag:
	print('No')
else:
	print('Yes')


s = list(input().lower())
for i in range(len(s)):
	if s[i] in ['i', 'l']:
		s[i] = '1'
	if s[i] in ['o']:
		s[i] = '0'
n = int(input())
for j in range(n):
	t = list(input().lower())
	for i in range(len(t)):
		if t[i] in ['i', 'l']:
			t[i] = '1'
		if t[i] in ['o']:
			t[i] = '0'
	if s == t:
		print('No')
		exit(0)
print('Yes')


from sys import stdin, stdout
from random import randrange

def check(first, second):
	first = first.lower()
	second = second.lower()
	first = first.replace('0', 'o')
	second = second.replace('0', 'o')
	first = first.replace('1', 'l')
	second = second.replace('1', 'l')
	first = first.replace('i', 'l')
	second = second.replace('i', 'l')
	return first == second
s = stdin.readline().strip()
n = int(stdin.readline())
label = 0
for i in range(n):
	f = stdin.readline().strip()
	if check(f, s):
		label = 1
if label:
	stdout.write('No')
else:
	stdout.write('Yes')


def change(s):
	s = s.upper()
	s = s.replace('I', '1')
	s = s.replace('L', '1')
	s = s.replace('O', '0')
	return s
login = change(input())
g = True
n = int(input())
for i in range(n):
	x = change(input())
	if x == login:
		g = False
if g:
	print('Yes')
else:
	print('No')


s = input()
n = int(input())
a = []
flag = True
for i in range(n):
	x = input()
	if len(s) == len(x):
		k = 0
		for j in range(len(s)):
			if s[j].lower() == x[j].lower():
				k += 1
			elif (s[j] == '0' or s[j] == 'o' or s[j] == 'O') and (x[j] == '0' or x[j] == 'o' or x[j] == 'O'):
				k += 1
			elif (s[j] == '1' or s[j] == 'l' or s[j] == 'L' or (s[j] == 'i') or (s[j] == 'I')) and (x[j] == '1' or x[j] == 'l' or x[j] == 'L' or (x[j] == 'i') or (x[j] == 'I')):
				k += 1
			else:
				k = 0
				break
		if k == len(s):
			print('No')
			flag = False
			break
if flag:
	print('Yes')


def convert(string):
	s = [x for x in string]
	for i in range(len(string)):
		if s[i] == 'i' or s[i] == '1':
			s[i] = 'l'
		if s[i] == 'o':
			s[i] = '0'
	return ''.join(s)
s = convert(input().lower())
f = 1
n = int(input())
for i in range(n):
	temp = convert(input().lower())
	if temp == s:
		f = 0
		break
if f == 1:
	print('Yes')
else:
	print('No')


import sys
ans = 'Yes'
lines = sys.stdin.readlines()
for (i, line) in enumerate(lines):
	line = line.lower()
	line = line.replace('o', '0')
	line = line.replace('i', '1').replace('l', '1')
	line = line.strip()
	if i == 0:
		for ch in line:
			if ch not in 'abcdefghijklmnopqrstuvwxyz0123456789_':
				ans = 'No'
				break
		login = line
	if i == 1:
		n = int(line)
	if i > 1:
		if login == line:
			ans = 'No'
			break
print(ans)


new_login = input()
n = int(input())

def transform(login):
	return login.lower().replace('o', '0').replace('i', '1').replace('l', '1')
transformed = transform(new_login)
for i in range(n):
	login = input()
	if transform(login) == transformed:
		print('No')
		break
else:
	print('Yes')


def stand(log):
	log = log.lower()
	log = log.replace('0', 'o')
	log = log.replace('l', '1')
	log = log.replace('i', '1')
	return log
login = input()
kol = int(input())
logins = []
for i in range(kol):
	p = input()
	logins.append(p)
login = stand(login)
for i in range(kol):
	logins[i] = stand(logins[i])
for i in range(kol):
	if logins[i] == login:
		print('No')
		break
else:
	print('Yes')


def is_similar(one, two):
	one = one.lower()
	two = two.lower()
	one = one.replace('o', '0')
	one = one.replace('i', '1')
	one = one.replace('l', '1')
	two = two.replace('o', '0')
	two = two.replace('i', '1')
	two = two.replace('l', '1')
	return one == two
have_similar = False
newlogin = input()
counter = int(input())
for i in range(0, counter):
	login = input()
	if is_similar(newlogin, login):
		have_similar = True
		break
if have_similar:
	print('No')
else:
	print('Yes')


def reform(str):
	return str.lower().replace('0', 'o').replace('1', 'l').replace('i', 'l')
login = reform(input())
count = int(input())
for i in range(count):
	if login == reform(input()):
		print('No')
		exit()
print('Yes')


s = input()

def normalize(s):
	s1 = ''
	for q in range(len(s)):
		if s[q] == '0' or s[q] == 'o':
			s1 = s1 + 'O'
		elif s[q] == 'l' or s[q] == 'I' or s[q] == 'i' or (s[q] == 'L'):
			s1 = s1 + '1'
		elif s[q].islower():
			s1 = s1 + chr(ord(s[q]) - 32)
		else:
			s1 = s1 + s[q]
	return s1
s = normalize(s)
n = int(input())
f = 0
for q in range(n):
	s2 = input()
	s2 = normalize(s2)
	if s2 == s:
		f = 1
if f:
	print('No')
else:
	print('Yes')


s = input().lower()
eq = [{'o', '0'}, {'1', 'l', 'i'}]
n = int(input())
for _ in range(n):
	s2 = input().lower()
	if len(s) != len(s2):
		continue
	diff = False
	for i in range(len(s)):
		if s[i] == s2[i]:
			continue
		if s[i] in eq[0] and s2[i] in eq[0]:
			continue
		if s[i] in eq[1] and s2[i] in eq[1]:
			continue
		diff = True
		break
	if not diff:
		print('No')
		exit()
print('Yes')


def tr(s):
	return s.lower().replace('o', '0').replace('l', '1').replace('i', '1')
s = tr(input())
n = int(input())
ss = set((tr(input()) for _ in range(n)))
print('Yes' if s not in ss else 'No')


s = input()
n = int(input())
a = ['o', 'O', '0']
b = ['I', 'l', '1', 'i', 'L']
flak = 0
for i in range(n):
	h = input()
	e = ord('A') - ord('a')
	if len(h) == len(s):
		for i in range(len(s)):
			if s[i] in a and h[i] in a:
				continue
			elif s[i] in b and h[i] in b:
				continue
			elif s[i] == h[i]:
				continue
			elif ord(s[i]) + e == ord(h[i]) or ord(h[i]) + e == ord(s[i]):
				continue
			else:
				break
		else:
			print('No')
			flak = 1
if flak == 0:
	print('Yes')


def procces(s):
	s = s.lower()
	s = s.replace('0', 'o')
	s = s.replace('1', 'l')
	s = s.replace('i', 'l')
	return s
s = procces(input())
n = int(input())
data = []
for i in range(n):
	t = procces(input())
	if s == t:
		print('No')
		exit()
print('Yes')


s = input()
str_copy = list(s)
s_copy = ''
for i in range(len(s)):
	if str_copy[i] == 'O' or str_copy[i] == 'o':
		str_copy[i] = '0'
	if str_copy[i] == 'l' or str_copy[i] == 'I' or str_copy[i] == 'L' or (str_copy[i] == 'i'):
		str_copy[i] = '1'
	s_copy += str_copy[i]
n = int(input())
fl = True
for i in range(n):
	st = input()
	if fl:
		str_copy = list(st)
		st_copy = ''
		if len(st) == len(s):
			for i in range(len(s)):
				if str_copy[i] == 'O' or str_copy[i] == 'o':
					str_copy[i] = '0'
				if str_copy[i] == 'l' or str_copy[i] == 'I' or str_copy[i] == 'L' or (str_copy[i] == 'i'):
					str_copy[i] = '1'
				st_copy += str_copy[i]
		if st_copy.lower() == s_copy.lower():
			fl = False
if fl:
	print('Yes')
else:
	print('No')


def login(log1, log2):
	if log1.lower() == log2.lower():
		return False
	log2 = log2.replace('o', '0').replace('O', '0').replace('i', '1').replace('I', '1').replace('l', '1').replace('L', '1')
	log1 = log1.replace('o', '0').replace('O', '0').replace('i', '1').replace('I', '1').replace('l', '1').replace('L', '1')
	return not log1 == log2
log = input()
n = int(input())
tmp = 0
for l in range(n):
	if login(log, input()):
		tmp += 1
print('Yes') if tmp == n else print('No')


def normalize(s):
	chs = {'o': '0', 'i': '1', 'l': '1'}
	return ''.join((chs.get(ch, ch) for ch in s.lower()))

def main():
	s1 = normalize(input())
	n = int(input())
	for i in range(n):
		s2 = input()
		if normalize(s2) == s1:
			return 'No'
	return 'Yes'
print(main())


a = input()
n = int(input())
b = [[] for i in range(n)]
d = []
for i in range(n):
	c = input()
	for j in range(len(c)):
		b[i].append(set())
		f = ord(c[j])
		f2 = c[j]
		if f >= 65 and f <= 90:
			b[i][j].add(f)
			f += 32
			b[i][j].add(f)
		elif f >= 97 and f <= 122:
			b[i][j].add(f)
			b[i][j].add(f - 32)
		if f == 105:
			b[i][j].add(49)
			b[i][j].add(108)
			b[i][j].add(76)
		if f == 108:
			b[i][j].add(49)
			b[i][j].add(105)
			b[i][j].add(73)
		if f >= 48 and f <= 58:
			b[i][j].add(f)
		if f == 49:
			b[i][j].add(105)
			b[i][j].add(73)
			b[i][j].add(108)
			b[i][j].add(76)
		if f == 48:
			b[i][j].add(111)
			b[i][j].add(79)
		if f == 95:
			b[i][j].add(95)
		if f == 111:
			b[i][j].add(48)
k = 0
for i in range(n):
	d = 0
	for j in range(len(a)):
		if j < len(b[i]):
			if ord(a[j]) not in b[i][j]:
				d = 1
	if len(a) != len(b[i]):
		d = 1
	if d == 0:
		k = 1
if k == 0:
	print('Yes')
else:
	print('No')


REPLACES = ['0O', 'O0', '1L', 'L1', '1I', 'I1', 'IL', 'LI']
login = input().upper()
for i in range(int(input())):
	reserved = input().upper()
	if len(reserved) == len(login):
		for (a, b) in zip(login, reserved):
			if a != b and a + b not in REPLACES:
				break
		else:
			print('No')
			break
else:
	print('Yes')


def reduction(c, depth=0):
	if c.isalpha() and c.isupper():
		c = chr(ord('a') + ord(c) - ord('A'))
	if c == '0':
		c = 'o'
	if c in ['l', 'I', '1']:
		c = 'I'
	return c if depth == 3 else reduction(c, depth + 1)

def check(s, t):
	n = len(s)
	if n != len(t):
		return False
	for i in range(n):
		if reduction(s[i]) != reduction(t[i]):
			return False
	return True
s = input()
n = int(input())
for _ in range(n):
	t = input()
	if check(s, t):
		print('No')
		raise SystemExit
print('Yes')


def r(s):
	ss = s.lower()
	ss = ss.replace('i', '1')
	ss = ss.replace('l', '1')
	ss = ss.replace('o', '0')
	return ss
login = r(input())
n = int(input())
Allowed = True
for i in range(n):
	s = r(input())
	if login == s:
		Allowed = False
if Allowed:
	print('Yes')
else:
	print('No')


def main():
	login = input()
	login = login.lower()
	login = login.replace('o', '0')
	login = login.replace('l', '1')
	login = login.replace('i', '1')
	n = int(input())
	for i in range(n):
		s = input()
		s = s.lower()
		s = s.replace('o', '0')
		s = s.replace('l', '1')
		s = s.replace('i', '1')
		if login == s:
			print('No')
			break
	else:
		print('Yes')
main()


def great_replace(str):
	return str.replace('o', '0').replace('l', '1').replace('i', '1')

def check(l1, l2):
	l1 = great_replace(l1)
	l2 = great_replace(l2)
	return l1 == l2
login_to_check = input().lower()
n = int(input())
res = False
for i in range(0, n):
	curr_login = input().lower()
	if check(login_to_check, curr_login):
		res = True
print('Yes') if res is False else print('No')


s = input()
n = int(input())
logins = []
while n > 0:
	logins.append(input())
	n -= 1
s = s.lower()
logins = [login.lower() for login in logins]
result = 'Yes'
for login in logins:
	c1 = s.replace('o', '0') == login.replace('o', '0')
	c2 = s.replace('1', 'l') == login.replace('1', 'l')
	c3 = s.replace('i', 'l') == login.replace('i', 'l')
	c4 = s.replace('i', '1') == login.replace('i', '1')
	if any([c1, c2, c3, c4]):
		result = 'No'
		break
print(result)


def transf(s):
	return s.lower().replace('o', '0').replace('l', '1').replace('i', '1')

def check():
	s = input()
	n = int(input())
	for i in range(n):
		l = input()
		if len(s) != len(l):
			continue
		if transf(s) == transf(l):
			return 'No'
	return 'Yes'
print(check())


def same(s, t):
	TMP_1 = {'o', '0'}
	TMP_2 = {'1', 'l', 'i'}
	if len(s) != len(t):
		return False
	for (sl, tl) in zip(s.lower(), t.lower()):
		if sl == tl:
			continue
		elif sl in TMP_1 and tl in TMP_1:
			continue
		elif sl in TMP_2 and tl in TMP_2:
			continue
		else:
			return False
	return True
new_login = input().strip()
n = int(input())
result = 'Yes'
for _ in range(n):
	old_login = input().strip()
	if same(new_login, old_login):
		result = 'No'
		break
print(result)


def login(data=None):
	if data is None:
		gen_data = input
	else:
		data_iter = iter(data.split('\n'))
		gen_data = data_iter.__next__
	wanted_login = gen_data()
	n = int(gen_data())
	similar = []
	for _ in range(n):
		similar.append(gen_data())
	for s in similar:
		if check(wanted_login, s):
			return 'No'
	return 'Yes'

def check(wanted, current):
	if len(wanted) != len(current):
		return False
	for i in range(len(wanted)):
		(w_letter, c_letter) = (wanted[i], current[i])
		if not check_letter(w_letter, c_letter):
			return False
	return True

def check_letter(w: str, c: str):
	if w == c:
		return True
	if w.isalpha() and c.isalpha() and (w.upper() == c.upper()):
		return True
	for i in identical:
		if w in i and c in i:
			return True
identical = (('0', 'O', 'o'), ('1', 'I', 'l', 'i', 'L'))
print(login())


login = input().lower()
mas = [login]
m_logins = [str(i) for i in login]
s = m_logins.copy()
ms = m_logins.copy()
con = 0

def mas_len(st):
	w = ''
	for i in st:
		w += i
	return w
for i in range(len(login)):
	if login[i] == 'o':
		s[i] = '0'
		ms[i] = '0'
		b = mas_len(ms)
		a = mas_len(s)
		mas.append(a)
		mas.append(b)
		s = m_logins.copy()
	if login[i] == '0':
		s[i] = 'o'
		ms[i] = 'o'
		b = mas_len(ms)
		a = mas_len(s)
		mas.append(a)
		mas.append(b)
		s = m_logins.copy()
	if login[i] == '1':
		s[i] = 'l'
		ms[i] = 'l'
		b = mas_len(ms)
		a = mas_len(s)
		mas.append(a)
		mas.append(b)
		s = m_logins.copy()
	if login[i] == 'l':
		s[i] = '1'
		ms[i] = '1'
		b = mas_len(ms)
		a = mas_len(s)
		mas.append(a)
		mas.append(b)
		s = m_logins.copy()
	if login[i] == '1':
		s[i] = 'i'
		ms[i] = 'i'
		b = mas_len(ms)
		a = mas_len(s)
		mas.append(a)
		mas.append(b)
		s = m_logins.copy()
	if login[i] == 'i':
		s[i] = '1'
		ms[i] = '1'
		b = mas_len(ms)
		a = mas_len(s)
		mas.append(a)
		mas.append(b)
		s = m_logins.copy()
	if login[i] == 'i':
		s[i] = 'l'
		ms[i] = 'l'
		b = mas_len(ms)
		a = mas_len(s)
		mas.append(a)
		mas.append(b)
		s = m_logins.copy()
	if login[i] == 'l':
		s[i] = 'i'
		ms[i] = 'i'
		b = mas_len(ms)
		a = mas_len(s)
		mas.append(a)
		mas.append(b)
		s = m_logins.copy()
n = int(input())
for i in range(n):
	log = str(input()).lower()
	for j in range(len(mas)):
		if mas[j] == log:
			con += 1
			break
if con >= 1:
	print('No')
else:
	print('Yes')


s = input()

def f(a):
	a = a.lower()
	a = a.replace('o', '0')
	a = a.replace('i', '1')
	a = a.replace('l', '1')
	return a
s = f(s)
q = int(input())
b = True
for i in range(0, q):
	d = input()
	if s == f(d):
		b = False
print('Yes' if b else 'No')


pw = input().lower()
n = int(input())
words = [input().lower() for i in range(n)]
allowed = True
for word in words:
	if len(word) != len(pw):
		continue
	same_letters = 0
	for (num, letter) in enumerate(pw):
		if word[num] == letter:
			same_letters += 1
			continue
		elif word[num] in '0o' and letter in '0o':
			same_letters += 1
			continue
		elif word[num] in '1IiLl' and letter in '1IiLl':
			same_letters += 1
			continue
	if same_letters == len(pw):
		allowed = False
		break
if allowed:
	print('Yes')
else:
	print('No')


def convert(s):
	s = s.lower()
	s = s.replace('0', 'o')
	s = s.replace('1', 'l')
	s = s.replace('i', 'l')
	return s
s = input()
s = convert(s)
n = int(input())
for i in range(n):
	s1 = convert(input())
	if s == s1:
		print('No')
		exit(0)
print('Yes')


from math import *
from random import *
from copy import *
import os, sys
s = input()
n = int(input())
sim = {'o': '0', '1': 'l', 'l': 'i', 'i': '1'}
for i in range(n):
	now = input()
	if len(now) == len(s):
		eq = True
		for (c1, c2) in zip(s, now):
			(c1, c2) = (c1.lower(), c2.lower())
			if c1 != c2 and (c1 not in sim or sim[c1] != c2) and (c2 not in sim or sim[c2] != c1):
				eq = False
				break
		if eq:
			print('No\n')
			exit()
print('Yes')


a = input().lower()
c = 'o0'
d = 'i1l'
print('YNeos'[any((len(a) == len(x) and all((u == v or (u in c and v in c) or (u in d and v in d) for (u, v) in zip(a, x))) for x in [input().lower() for _ in ' ' * int(input())]))::2])


def to_low(c):
	if 'A' <= c <= 'Z':
		return chr(ord(c) + ord('a') - ord('A'))
	return c

def f(s):
	a = list(s)
	m = len(a)
	for i in range(m):
		a[i] = to_low(a[i])
	for i in range(m):
		if a[i] in 'li':
			a[i] = '1'
		if a[i] in 'o':
			a[i] = '0'
	return ''.join(a)
s = f(input())
n = int(input())
a = [f(input()) for i in range(n)]
ans = 'No' if s in a else 'Yes'
print(ans)


def f(c):
	c = c.lower()
	if c == 'o':
		return '0'
	if c in 'il':
		return '1'
	return c

def lo(s):
	return ''.join([f(c) for c in s])

def main():
	login = lo(input())
	n = int(input())
	arr = [lo(input()) for i in range(n)]
	if login not in arr:
		print('Yes')
	else:
		print('No')
main()


s = input()
n = int(input())
t = [['1', 'l', 'i'], ['o', '0']]
g = True
for i in range(n):
	nick = input()
	if len(s) != len(nick):
		continue
	f = True
	for i in range(len(s)):
		if s[i].lower() == nick[i].lower():
			continue
		if s[i].lower() in t[0] and nick[i].lower() in t[0]:
			continue
		if s[i].lower() in t[1] and nick[i].lower() in t[1]:
			continue
		f = False
		break
	if f:
		g = False
		break
if g:
	print('Yes')
else:
	print('No')


def modify(s):
	s = s.upper()
	change = {'O': '0', 'I': '1', 'L': '1'}
	res = [change[c] if c in change else c for c in s]
	return str(res).lower()
t = modify(input())
n = int(input())
used = set([modify(input()) for _ in range(n)])
print('Yes') if t not in used else print('No')


s = input()
n = int(input())
fflag = 0
for _ in range(n):
	s1 = input()
	if len(s) != len(s1):
		continue
	flag = 1
	for i in range(len(s)):
		if s[i] == s1[i] or s[i] == s1[i].swapcase():
			continue
		elif s[i] == '1' and (s1[i] == 'l' or s1[i] == 'I' or s1[i] == 'L' or (s1[i] == 'i')):
			continue
		elif (s[i] == 'l' or s[i] == 'L') and (s1[i] == '1' or s1[i] == 'I' or s1[i] == 'i'):
			continue
		elif (s[i] == 'I' or s[i] == 'i') and (s1[i] == '1' or s1[i] == 'L' or s1[i] == 'l'):
			continue
		elif (s[i] == 'O' or s[i] == 'o') and s1[i] == '0' or (s[i] == '0' and (s1[i] == 'O' or s1[i] == 'o')):
			continue
		else:
			flag = 0
			break
	if flag == 1:
		fflag = 1
		print('No')
		break
if fflag == 0:
	print('Yes')


import re

def minify(s):
	s = s.lower()
	s = re.sub('o', '0', s)
	s = re.sub('[l|i]', '1', s)
	return s

def main():
	login = minify(input())
	n = int(input())
	logins = list(map(minify, [input().strip() for x in range(n)]))
	print('No' if login in logins else 'Yes')
main()


def fi(x, y):
	temp = y.split()
	ans = []
	stop = 0
	for i in temp:
		try:
			while True:
				ans.append(x.index(i, stop))
				stop = ans[len(ans) - 1] + 1
		except ValueError:
			stop = 0
			continue
	return ans

def l1(x, y):
	ans = []
	s1 = fi(x, 'L l I i')
	s2 = fi(y, 'L l I i')
	f1 = fi(x, '1 L l I i')
	f2 = fi(y, '1 L l I i')
	for i in s1:
		for j in f2:
			if i == j:
				ans.append(i)
	for i in f1:
		for j in s2:
			if i == j:
				ans.append(i)
	return ans

def o0(x, y):
	ans = []
	o1 = fi(x, 'o O')
	o2 = fi(y, 'o O')
	z1 = fi(x, '0')
	z2 = fi(y, '0')
	for i in o1:
		for j in z2:
			if i == j:
				ans.append(i)
	for i in z1:
		for j in o2:
			if i == j:
				ans.append(i)
	return ans

def lol(x, y):
	return l1(x, y) + o0(x, y)

def reg(x, y):
	ans = []
	temp = [z for z in range(10)]
	for i in range(len(x)):
		try:
			cl = int(x[i])
		except:
			try:
				if (x[i].upper() == y[i] or x[i] == y[i].upper()) and (not x[i] == '_'):
					ans.append(i)
			except IndexError:
				break
	return ans

def su(x, y):
	temp = x + y
	temp.sort()
	ans = []
	try:
		ans.append(temp[0])
		for i in range(1, len(temp)):
			if temp[i] != temp[i - 1]:
				ans.append(temp[i])
	except:
		none = None
	return ans

def change(x, y):
	for i in range(len(y)):
		x = x[:y[i]] + x[y[i] + 1:]
		y = [k - 1 for k in y]
	return x

def ch(x, y):
	if x == y:
		return False
	li = su(reg(x, y), lol(x, y))
	if not li:
		return True
	x = change(x, li)
	y = change(y, li)
	if not x:
		return False
	return x != y

def main():
	log = input()
	m = []
	for i in range(int(input())):
		m.append(input())
	ans = True
	for i in range(len(m)):
		if not ch(m[i], log):
			ans = False
			break
	print(('No', 'Yes')[ans])
main()


def format(string):
	string = string.lower()
	string = string.replace('0', 'o')
	string = string.replace('1', 'l')
	string = string.replace('l', 'i')
	return string
newlogin = input()
isOk = True
newlogin = format(newlogin)
length = int(input())
for x in range(length):
	check = input()
	check = format(check)
	if check == newlogin:
		isOk = False
if isOk:
	print('Yes')
else:
	print('No')


(s, n) = (input(), int(input()))
s = s.replace('O', '0')
s = s.replace('o', '0')
for _ in range(n):
	stp = ''
	a = input()
	if len(a) == len(s):
		for i in range(len(a)):
			if a[i] in '1lILi' and s[i] in '1lILi':
				stp += a[i]
			else:
				stp += s[i]
		a = a.replace('O', '0')
		a = a.replace('o', '0')
		stp = stp.lower()
		a = a.lower()
		if a == stp:
			print('No')
			break
else:
	print('Yes')


def change(a: str):
	a = a.upper()
	a = a.replace('O', '0')
	a = a.replace('L', '1')
	a = a.replace('I', '1')
	return a
a = change(input())
flag = True
for _ in range(int(input())):
	b = change(input())
	if a == b:
		flag = False
print('Yes' if flag else 'No')


import re

def norm(s):
	s = s.lower()
	s = re.sub('i', '1', re.sub('0', 'o', re.sub('l', '1', s)))
	return s
s = norm(input())
for i in range(int(input())):
	if norm(input()) == s:
		print('No')
		exit(0)
print('Yes')


s = input()
u = 0
for i in range(int(input())):
	l = input()
	u = 0
	if len(l) == len(s):
		for j in range(len(l)):
			if l[j].lower() == s[j].lower() or (l[j] == '0' and s[j].lower() == 'o') or (s[j] == '0' and l[j].lower() == 'o') or (l[j] == '1' and (s[j].lower() == 'l' or s[j].upper() == 'I')) or (l[j].lower() == 'l' and (s[j] == '1' or s[j].upper() == 'I')) or (l[j].upper() == 'I' and (s[j].lower() == 'l' or s[j] == '1')):
				u += 1
			else:
				break
	if u == len(s):
		break
if u == len(s):
	print('No')
else:
	print('Yes')


def prettify(s):
	s = s.lower()
	s = s.replace('0', 'o')
	s = s.replace('1', 'l')
	s = s.replace('i', 'l')
	return s

def solve():
	login = prettify(input())
	n = int(input())
	users = set((prettify(input()) for i in range(n)))
	if login in users:
		print('No')
	else:
		print('Yes')
t = 1
for _ in range(t):
	solve()


def transform(s):
	s = s.replace('0', 'O')
	s = s.lower()
	s = s.replace('l', 'i')
	s = s.replace('1', 'i')
	return s
s = input()
n = int(input())
a = [input() for i in range(n)]
s = transform(s)
key = 0
for element in a:
	if transform(element) == s:
		key = 1
		break
if key:
	print('No')
else:
	print('Yes')


mapper = {'i': '1', 'l': '1', 'o': '0'}

def normalize(login):
	return ''.join((mapper.get(ch, ch) for ch in login.lower()))

def main():
	login = normalize(input())
	n = int(input())
	while n:
		n -= 1
		if login == normalize(input()):
			print('No')
			break
	else:
		print('Yes')
main()


import sys
import math
from collections import defaultdict

def solve(test):
	log = input().lower()
	l = len(log)
	n = int(input())
	for i in range(n):
		s = input().lower()
		if len(s) == l:
			flag = 0
			for i in range(l):
				if s[i] == log[i]:
					continue
				elif s[i] in ('0', 'o') and log[i] in ('0', 'o'):
					continue
				elif s[i] in ('l', 'i', '1') and log[i] in ('l', 'i', '1'):
					continue
				else:
					flag = 1
					break
			if flag:
				continue
			else:
				print('No')
				return
	print('Yes')
test_cases = 1
for t in range(1, test_cases + 1):
	solve(t)


new_login = input()
count_logins = int(input())
logins = []
for _ in range(count_logins):
	logins.append(input())

def check_login(pattern, login):
	length = len(pattern)
	if length != len(login):
		return False
	for i in range(length):
		if pattern[i].lower() == login[i].lower():
			continue
		rules = [set('1iIlL'), set('Oo0')]
		not_same = True
		for rule in rules:
			if pattern[i] in rule and login[i] in rule:
				not_same = False
				break
		if not_same:
			return False
	return True
same = False
for current_login in logins:
	if check_login(current_login, new_login):
		same = True
		break
if same:
	print('No')
else:
	print('Yes')


def can_exist(login, existing_logins):
	for word in existing_logins:
		if len(word) == len(login):
			for i in range(len(word)):
				if word[i].replace('o', '0').replace('l', '1').replace('i', '1') == login[i].replace('o', '0').replace('l', '1').replace('i', '1'):
					continue
				break
			else:
				return 'No'
	return 'Yes'
login = input().lower()
n = int(input())
existing_logins = list()
for i in range(n):
	existing_logins.append(input().lower())
print(can_exist(login, existing_logins))


l = input()
new_login1 = l.upper().replace('O', '0').replace('l', '1').replace('I', '1')
new_login2 = l.replace('O', '0').replace('l', '1').replace('I', '1').lower()
new_login3 = l.lower().replace('O', '0').replace('l', '1').replace('I', '1')
logins = []
n = int(input())
for i in range(n):
	last = input()
	logins.append(last.upper().replace('O', '0').replace('l', '1').replace('I', '1'))
	logins.append(last.replace('O', '0').replace('l', '1').replace('I', '1').lower())
	logins.append(last.lower().replace('O', '0').replace('l', '1').replace('I', '1'))
print('No' if new_login1 in logins or new_login2 in logins or new_login3 in logins else 'Yes')


def liker(data):
	data = data.upper()
	data = data.replace('O', '0')
	data = data.replace('L', 'I')
	data = data.replace('I', '1')
	return data
login = liker(input())
numOfLogins = int(input())
loginsArray = [liker(input()) for x in range(numOfLogins)]
if login in loginsArray:
	print('No')
else:
	print('Yes')


import re
login = input()
loginn = int(input())
logins = set()
for i in range(loginn):
	logins.add(re.sub('1|l', 'i', input().lower().replace('0', 'o')))
if re.sub('1|l', 'i', login.lower().replace('0', 'o')) in logins:
	print('No')
else:
	print('Yes')


s = input()
n = int(input())
t = []
a = ['0', 'O', 'o']
b = ['1', 'i', 'l', 'L', 'I']
flag = 'Yes'
k = 0
for i in range(n):
	t.append(input())
	if len(s) == len(t[i]) and flag != 'No':
		for j in range(len(s)):
			if s[j] in a:
				if t[i][j] not in a and t[i][j].swapcase() != s[j]:
					break
			elif s[j] in b:
				if t[i][j] not in b and t[i][j].swapcase() != s[j]:
					break
			elif s[j] != t[i][j] and s[j] != t[i][j].swapcase():
				break
			k += 1
	if k == len(s):
		flag = 'No'
	else:
		k = 0
print(flag)


def is_similar_chars(char1, char2):
	if char1.lower() == char2.lower():
		return True
	if char1 == 'o' and char2 == '0' or (char1 == '0' and char2 == 'o'):
		return True
	if char1 == 'l' and char2 == '1' or (char1 == '1' and char2 == 'l') or (char1 == 'l' and char2 == 'i') or (char1 == 'i' and char2 == 'l') or (char1 == '1' and char2 == 'i') or (char1 == 'i' and char2 == '1'):
		return True
	return False
original_str = input().lower()
number_str = int(input())
for i in range(number_str):
	check_str = input().lower()
	if len(original_str) != len(check_str):
		continue
	for count in range(len(check_str)):
		if check_str[count] != original_str[count]:
			if not is_similar_chars(check_str[count], original_str[count]):
				break
			if count == len(check_str) - 1:
				print('No', end='')
				exit()
		if count == len(check_str) - 1:
			print('No', end='')
			exit()
print('Yes', end='')


login = input()
n = int(input())
login_list = [input() for _ in range(n)]
canRegister = True
tmp_login = login[:]
tmp_login = tmp_login.lower().replace('o', '0')
tmp_login = tmp_login.replace('i', '1')
tmp_login = tmp_login.replace('l', '1')
for current_login in login_list:
	current_login = current_login.lower().replace('o', '0')
	current_login = current_login.replace('i', '1')
	current_login = current_login.replace('l', '1')
	if current_login == tmp_login:
		canRegister = False
if canRegister:
	print('Yes')
else:
	print('No')


s = input()
n = int(input())
f = True

def is_sim(s1, s2):
	if len(s1) != len(s2):
		return False
	for i in range(len(s1)):
		if s1[i].lower() == s2[i].lower() or s1[i] + s2[i] in ['O0', '0O', 'o0', '0o'] or (s1[i] in ['1', 'l', 'I', 'i', 'L'] and s2[i] in ['1', 'l', 'I', 'i', 'L']):
			pass
		else:
			return False
	return True
for i in range(n):
	t = input()
	if is_sim(s, t):
		f = False
print('Yes' if f else 'No')


s = input().lower().replace('o', '0').replace('i', '1').replace('l', '1')
cnt = int(input())
is_correct = 'Yes'
for i in range(cnt):
	t = input().lower().replace('o', '0').replace('i', '1').replace('l', '1')
	if t == s:
		is_correct = 'No'
print(is_correct)


W1 = {'O', '0', 'o'}
W2 = {'I', '1', 'l', 'L', 'i'}

def analysis(login):
	out = ''
	for s in login:
		if s in W1:
			out += '0'
		elif s in W2:
			out += '1'
		elif s.isupper():
			out += s.lower()
		else:
			out += s
	return out
user = analysis(input())
n = int(input())
for i in range(n):
	login = analysis(input())
	if user == login:
		print('No')
		break
else:
	print('Yes')


l = input()
f = lambda x: x.lower().replace('0', 'o').replace('1', 'l').replace('i', 'l')
print(['Yes', 'No'][f(l) in map(f, [input() for _ in range(int(input()))])])


def trans(log):
	log = list(log)
	for i in range(len(log)):
		if log[i] == '0':
			log[i] = 'O'
		if log[i] in ('l', 'L'):
			log[i] = '1'
		if log[i] == '1':
			log[i] = 'I'
	log = list(map(lambda x: x.upper(), log))
	return ''.join(log)
login = input()
login = trans(login)
N = int(input())
logins = set()
for i in range(N):
	logins.add(trans(input()))
if login in logins:
	print('No')
else:
	print('Yes')