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: interview

Starter code:

Solutions:
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")


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
        # print(s[j], t[j], s, t, i)
        break
    else:
        print('No')
        return
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")
		return

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')
		return
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')

#!/usr/bin/env python3


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')


def __starting_point():
    main()

__starting_point()

import sys
a = input()
n = int(input())
s = ''
for i in a:
    if (i == 'O') or (i == 'o'):
        s = s + '0'
    else:
        if (i == 'l') or (i == 'I') or (i == 'L') or (i == 'i'):
            s = s + '1'
        else:
            s = s + i.lower()
for j in range(n):
    a = input()
    str = ''
    for i in a:
        if (i == 'O') or (i == 'o'):
            str = str + '0'
        else:
            if (i == 'l') or (i == 'I') or (i == 'L') or (i == 'i'):
                str = str + '1'
            else:
                str = str + i.lower()
    if s == str:
        print('No')
        return
print('Yes')


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 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')


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')

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 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')
        return
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')


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 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')


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 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")


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 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')
#print(a)


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')


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 make_hash(string):
    return string.lower().replace('o', '0').replace('l', '1').replace('i', '1')
    
s = make_hash(input())
n = int(input())
e = []
good = True
for _ in range(n):
    t = input()
    if make_hash(t) == s:
        good = False
print("Yes" if good else "No")