Polycarp is a beginner programmer. He is studying how to use a command line.

Polycarp faced the following problem. There are n files in a directory and he needs to delete some of them. Polycarp wants to run a single delete command with filename pattern as an argument. All the files to be deleted should match the pattern and all other files shouldn't match the pattern.

Polycarp doesn't know about an asterisk '*', the only special character he knows is a question mark '?' which matches any single character. All other characters in the pattern match themselves only.

Formally, a pattern matches a filename if and only if they have equal lengths and all characters in the corresponding positions are equal except when the character in the pattern is '?', in which case the corresponding filename character does not matter.

For example, the filename pattern "a?ba?":  matches filenames "aabaa", "abba.", "a.ba9" and "a.ba.";  does not match filenames "aaba", "abaab", "aabaaa" and "aabaa.". 

Help Polycarp find a pattern which matches files to be deleted and only them or report if there is no such pattern.


-----Input-----

The first line of the input contains two integers n and m (1 ≤ m ≤ n ≤ 100) — the total number of files and the number of files to be deleted.

The following n lines contain filenames, single filename per line. All filenames are non-empty strings containing only lowercase English letters, digits and dots ('.'). The length of each filename doesn't exceed 100. It is guaranteed that all filenames are distinct.

The last line of the input contains m distinct integer numbers in ascending order a_1, a_2, ..., a_{m} (1 ≤ a_{i} ≤ n) — indices of files to be deleted. All files are indexed from 1 to n in order of their appearance in the input.


-----Output-----

If the required pattern exists, print "Yes" in the first line of the output. The second line should contain the required pattern. If there are multiple solutions, print any of them.

If the required pattern doesn't exist, print the only line containing "No".


-----Examples-----
Input
3 2
ab
ac
cd
1 2

Output
Yes
a?

Input
5 3
test
tezt
test.
.est
tes.
1 4 5

Output
Yes
?es?

Input
4 4
a
b
c
dd
1 2 3 4

Output
No

Input
6 3
.svn
.git
....
...
..
.
1 2 3

Output
Yes
.???

Difficulty: competition

Starter code:

Solutions:
m,n=list(map(int,input().split()))
s=[input().strip() for i in range(m)]
a=list([int(x)-1 for x in input().split()])
stmpl=s[a[0]]
f=1
def peres(s1,s2):
	return ''.join([i if i==j else '?' for i,j in zip(s1,s2)])
for i in a:
	if len(stmpl)!=len(s[i]):
		f=0
		break
	stmpl=peres(stmpl,s[i])
for i,e in enumerate(s):
	if i in a:
		continue
	if len(stmpl)==len(e) and stmpl==peres(stmpl,e):
		f=0
		break
if f:
	print('Yes')
	print(stmpl)
else:
	print('No')


n, m = list(map(int,input().split()))
w = [input() for _ in range(n)]
todel = [w[i-1] for i in map(int, input().split())]
if len(set(map(len,todel))) != 1:
    print('No')
else:
    pat = ''.join(['?' if len(set([todel[j][p] for j in range(m)])) != 1 else todel[0][p] for p in range(len(todel[0]))])
    ok = True
    for x in w:
        if len(x) != len(pat):
            continue
        if not x in todel:
            mat = True
            for i in range(len(pat)):
                if pat[i] != '?' and pat[i] != x[i]:
                    mat = False
                    break
            if mat:
                ok = False
                break
    if not ok:
        print('No')
    else:
        print('Yes')
        print(pat)


import sys
import re

[words, selected] = input().split(" ")
[words, selected] = [int(words), int(selected)]
wordBuffer = []
selectedWords = []

for i in range(words):
    wordBuffer.append(input())
buffer = input().split(" ")
for i in buffer:
    selectedWords.append(wordBuffer[int(i) - 1])

for i in range(len(selectedWords)):
    if (i > 0 and len(selectedWords[i - 1]) != len(selectedWords[i])):
        print("No")
        return

reg = ""
res = ""
for letter in range(len(selectedWords[0])):
    isQuested = False
    for i in range(selected):
        if (i > 0 and selectedWords[i - 1][letter] != selectedWords[i][letter]):
            reg += "."
            res += "?"
            isQuested = True
            break
    if (isQuested == False):
        if (selectedWords[0][letter] == "."):
            reg += "\\" + selectedWords[0][letter]
        else:
            reg += selectedWords[0][letter]
        res += selectedWords[0][letter]

matches = 0
for i in wordBuffer:
    if (re.fullmatch(reg, i) != None):
        matches += 1

if (matches == selected):
    print("Yes\n" + res)
else:
    print("No")


import sys

def __starting_point():
    n = input().split()
    n, m = int(n[0]), int(n[1])
    _l = list()
    for _ in range(n):
      _l.append(input())
    _ms = [int(x) - 1 for x in input().split()]
    common = list(_l[_ms[0]])
    reqlen = len(common)
    for indx in _ms[1:]:
        curr = _l[indx]
        clen = len(curr)
        if clen != reqlen:
            print('No')
            return
        for i in range(len(curr)):
            if curr[i] != common[i]:
                common[i] = '?'
    for i in range(len(_l)):
        if i not in _ms:
            curr = _l[i]
            if len(curr) != reqlen:
                continue
            good = False
            for j in range(reqlen):
                if common[j] == '?':
                    continue
                if common[j] != curr[j]:
                    good = True
            if not good:
                print('No')
                return
    print('Yes')
    print(''.join(common))
__starting_point()

n, m = map(int, input().split())
a = []
for i in range(n):
    a.append(input())
b = [int(_) for _ in input().split()]
p = list(a[b[0] - 1])
for i in range(1, len(b)):
    s = a[b[i] - 1]
    if len(s) != len(p):
        print("No")
        raise SystemExit
    for j in range(len(s)):
        if s[j] != p[j] and p[j] != '?':
            p[j] = '?'
k = 0
f = False
for i in range(n):
    if k < m and i + 1 == b[k]:
        k += 1
        continue
    s = a[i]
    if len(s) == len(p):
        f = True
        for j in range(len(s)):
            if s[j] != p[j] and p[j] != '?':
                f = False
                break
    if f:
        print("No")
        raise SystemExit
print("Yes")
print(''.join(p))

num_files, num_delete = list(map(int, input().split(' ')))

files = []
while num_files > 0:
	files.append( input() )
	num_files -= 1

indices_del = list( [x - 1 for x in list(map(int, input().split(' ')))] )
ind = 0

to_del = []
to_leave = []
for i in indices_del:
	if len(to_del) > 0 and len(files[i]) != len(to_del[0]):
		print ('No')
		return
	to_del.append(files[i])

for i in range(len(files)):
	if ind < len(indices_del) and i == indices_del[ind]:
		ind += 1
		continue
	if len(files[i]) == len(to_del[0]):
		to_leave.append(files[i])
	
res = []	
for pos in range(len(to_del[0])):
	d = set()
	for del_file in to_del:
		ch = del_file[pos]
		d.add( ch )
	if len(d) > 1:
		res.append( '?' )
	else:
		undef = False
		for leave_file in to_leave:
			pass
			'''
			if leave_file[pos] == ch:
				res.append( '?' )
				undef = True
			'''
		if not undef:
			res.append( ch )
			fn = lambda f: f[pos] == ch
			to_leave = list( filter(fn, to_leave) )

if len(to_leave) > 0:
	print('No')
else:
	print ('Yes')
	print(''.join(res))
			




__author__ = 'Think'
def check(s, password):
	if len(s)!=len(password):
		return False
	for i in range(len(password)):
		if password[i]!="?":
			if password[i]!=s[i]:
				return False
	return True

n, m=[int(i) for i in input().split()]
filenames=[]
for i in range(n):
	filenames.append(input())
deleted_indices=[int(i)-1 for i in input().split()]
deleted=[]
fails=False
for i in deleted_indices:
	deleted.append(filenames[i])
length=len(deleted[0])
for s in deleted[1:]:
	if len(s)!=length:
		fails=True
		print("No")
		break
if not fails:
	answer=list(deleted[0])
	for i in range(length):
		for s in deleted[1:]:
			if s[i]!=answer[i]:
				answer[i]="?"
				break
	for index in range(n):
		if index not in deleted_indices:
			if check(filenames[index], answer):
				print("No")
				fails=True
				break
	if not fails:
		print("Yes")
		for s in answer:
			print(s, end="")
		print()


n,m=list(map(int,input().split()))
l=[]
for i in range(n):
    x=input()
    l.append(x)
ind=list(map(int,input().split()))
ind = list(ind)
se = set(ind)
le = len(l[ind[0]-1])
flag=1
for i in range(m):
    if(len(l[ind[i]-1])!=le):
        flag=0
        break
if flag==1:
    s = ""
    for j in range(le):
        flagc=1
        c=l[ind[0]-1][j]
        for i in range(m):
            if l[ind[i]-1][j]!=c:
                flagc=0
                break
        if flagc==0:
            s=s+"?"
        else:
            s=s+c
    d =[]
    for i in range(n):
        if i+1 not in se:
            if len(l[i])==le:
                d.append(l[i])
    
    for word in d:
        flagw=1
        for i in range(le):
            if s[i]!='?' and s[i]!=word[i]:
                flagw=0
                break
        if flagw==1:
            flag=0
            break
if flag==1:
    print("Yes")
    print(s)
else:
    print("No")
            


n = int(input().split()[0])

all_files = [str(input()) for i in range(n)]

index_to_del = [int(i) - 1 for i in (input().split())]

def find_pattern(all_files, index_to_del):
    for i in index_to_del[1:]:
        if len(all_files[i]) != len(all_files[index_to_del[0]]):

            return "No"
    pattern = ''
    for i in range(len(all_files[index_to_del[0]])):
        added = False
        for j in (index_to_del[1:]):
            if all_files[j][i] != all_files[index_to_del[0]][i]:
                if not added:
                    pattern += '?'
                    added = True
        if not added:
            pattern += all_files[index_to_del[0]][i]


    for i in range(len(all_files)):
        if i not in index_to_del:
            if len(all_files[i]) == len(pattern):
                matching_chars = []
                for index in range(len(pattern)):
                    matching_chars.append(all_files[i][index] == pattern[index] or pattern[index] == '?')
                if all(matching_chars):
                    return "No"

    print("Yes")
    return pattern


print(find_pattern(all_files, index_to_del))


l=input().split()
n,m=int(l[0]),int(l[1])
d=[]
for i in range(n):
    ch=input()
    d.append(ch)
l=input().split()
l=[(int(x)-1) for x in l]
p=len(d[l[0]])
B=True
D=[]

for i in l:
    if len(d[i])==p:
        D.append(d[i])
    else:
        B=False
        break
t=[]

if B:
    for i in D[0]:
        t.append(i)
    
    for i in range(len(D)):
        for j in range(len(D[i])):
            if D[i][j]!=t[j] and t[j]!="?":
                t[j]='?'

if B==False:
    print('No')
else:
    C=False
    for i in range(len(d)):
        if i not in l:
            C=True
        if i not in l and len(d[i])==p:
            for j in range(len(d[i])):
                if t[j]!="?" and d[i][j]!=t[j]:
                    C=False
        elif i not in l and len(d[i])!=p:
            C=False
        
        if C==True and i not in l:
            break
    if C==False:
        print("Yes")
        for i in t:
            print(i,end="")
    else:
        print('No')
    

import collections

Input=input().split()
n=int(Input[0])
m=int(Input[1])
listfile=[]

for i in range(n):
    listfile.append(input())

listdet=list(map(int, input().split()))
listfile1=[]

valid = 0
for i in range(len(listdet)):
    if i==0:
        valid = len(listfile[listdet[i]-1])
    elif len(listfile[listdet[i]-1]) != valid:
        valid = -1
        break
    listfile1.append(listfile[listdet[i]-1])

result=''
if valid == -1:
    print("No")
else:
    temp=''
    for i in range(len(listfile1[0])):
        for j in range(len(listfile1)):
            if j==0:
                temp = listfile1[j][i]
            if listfile1[j][i] != temp:
                result+="?"
                break
            elif j == len(listfile1)-1:
                result+= listfile1[j][i]

    count=0
    for i in range(len(listfile)):
        if len(listfile[i]) == len(result) and (i+1 not in listdet):
            for j in range(len(listfile1[0])):
                if listfile[i][j] != result[j] and result[j] != "?":
                    count+=1
                    break
        elif len(listfile[i])!= len(result) and (i+1 not in listdet):
            count+=1
    
    if count == n-m:
        if result == "?"*len(listfile1):
            print("No")
        else:
            print("Yes")
            print(result)
    else:
        print("No")


#!/bin/python
import sys
counter = 0
allstrs = []
def firstnum (inpu):
    out = ""
    for char in inpu:
        if char == ' ':
            break
        out += char
    return int(out)
def secondnum (inpu):
    first = True
    out = ""
    for char in inpu:
        if char == ' ' and not(first):
            break
        elif char == ' ' and first:
            first = False
        out += char
    return int(out)


for line in sys.stdin:
    if counter == 0:
        counter += 1
    else:
        allstrs.append(line)

removalfiles = []

removalfilesnums = list(map(int, allstrs[allstrs.__len__() - 1].split(" ")))
for i in range(0, removalfilesnums.__len__() - 0):
    removalfiles.append(allstrs[removalfilesnums[i] - 1])
removalfiles = [s.strip('\n') for s in removalfiles]

for ff in removalfiles:
    if removalfiles[0].__len__() != ff.__len__():
        print("No")
        return

outString = ""
for ii in range(0, removalfiles[0].__len__()):
    broke = False
    for ff in removalfiles:
        if ff[ii] != removalfiles[0][ii]:
            broke = True
            outString += '?'
            break
    if not broke:
        outString += removalfiles[0][ii]

checklist = [s.strip('\n') for s in [allstrs[i] for i in range(0, allstrs.__len__()) if i + 1 not in removalfilesnums]]
for line in checklist:
    test = False
    if line.__len__() == outString.__len__():
        test = True
        for charLine, charOut in zip(line, outString):
            if charLine != charOut and charOut != '?':
                test = False
    if test:
        print("No")
        return
print("Yes")
print(outString)


n, m = [int(x) for x in input().split()]
slova = []
for i in range(n):
    slova.append(input())
na_zmazanie = [int(x)-1 for x in input().split()]

dlzka_zmazanych = len(slova[na_zmazanie[0]])
for i in na_zmazanie:
    if len(slova[i]) != dlzka_zmazanych:
        print("No")
        return

zmaz = [False] * n
for i in na_zmazanie:
    zmaz[i] = True
matchujuce_nie_na_zmazanie = [i for i in range(n) if zmaz[i] == False and len(slova[i]) == dlzka_zmazanych] 

pattern = ""
for i in range(0, dlzka_zmazanych):
    znak_prveho = slova[na_zmazanie[0]][i]
    for x in na_zmazanie:
        if slova[x][i] != znak_prveho:
            pattern += "?"
            break
    else:
        pattern += znak_prveho
        nove_matchujuce = []
        for y in matchujuce_nie_na_zmazanie:
            if slova[y][i] == znak_prveho: 
                nove_matchujuce.append(y)
        matchujuce_nie_na_zmazanie = nove_matchujuce

if len(matchujuce_nie_na_zmazanie) == 0:
    print("Yes")
    print(pattern)
else:
    print("No")


import sys
	
lines = sys.stdin.read().splitlines()


T, garb = list(map(int, lines[0].split()))

elim = list(map(int, lines[-1].split()))


common = []
other = []

for i in range(1,T+1):
	if i in elim:
		common.append(list(lines[i]))
	else:
		other.append(list(lines[i]))

res = "Yes"
leng = len(common[0])
word = common[0]
unwo = list("?"*leng)

for line in common:
	if len(line) == leng:
		word = [i if i == j else "?" for i, j in zip(line, word)]
	else:
		res = "No"
		break

for line in other:
	if len(line) == leng and [i if i == j else "?" for i, j in zip(line, word)] == word:
		res = "No"
		break
		
print(res)

if res == "Yes":
	print("".join(word))


n, m = map(int, input().split())
files = []
for _ in range(n):
    files.append(input())
toDelete = list(map(lambda s: int(s) - 1, input().split()))
pattern = files[toDelete[0]]
L = len(pattern)
for i in toDelete:
    if len(files[i]) != L:
        print('No')
        return
    for j in range(L):
        if pattern[j] != '?' and pattern[j] != files[i][j]:
            pattern = pattern[:j] + '?' + pattern[j + 1:]
for i in range(n):
    file = files[i]
    if i in toDelete or len(file) != L:
        continue
    match = True
    for j in range(L):
        if pattern[j] != '?' and pattern[j] != file[j]:
            match = False
            break
    if match:
        print('No')
        return
print('Yes')
print(pattern)

import sys
n,m = list(map(int, input().split()))
s = [input() for i in range(n)]
d=list([int(x)-1 for x in input().split()])
ans =  list(s[d[0]]);
for i in range(1,m):
    if len(s[d[i]]) != len(ans):
        print("No")
        return
    for o in range(0, max([len(ans), len(s[d[i]])])):
       if ans[o] != '?' and ans[o] != s[d[i]][o]:
            ans[o] = '?'
f = True
for i in range(0,n):
    if len(ans) != len(s[i]):
        continue
    if i in d:
        continue
    f = True
    for o in range(0,len(ans)):
        if ans[o] != '?' and ans[o] != s[i][o]:
            f = False
            break
    if f:
        print("No")
        return
print("Yes")
print(''.join(ans))



n,m=map(int,input().split())
name=[None]*n
for i in range(n):
	name[i]=input()
delete=list(map(int,input().split()))

len_pattern=len(name[delete[0]-1])
for i in range(m):
	if len(name[delete[i]-1])!=len_pattern:
		print("No")
		return

pattern=""
for i in range(len_pattern):
	cur_char=name[delete[0]-1][i]
	for j in range(m):
		if name[delete[j]-1][i]!=cur_char:
			pattern+="?"
			break;
	else:
		pattern+=cur_char

remain=[None]*(n-m)
count=0;
for i in range(n):
	if i+1 not in delete:
		remain[count]=i+1
		count+=1

for i in range(count):
	len_remain_name=len(name[remain[i]-1])
	if len_remain_name==len_pattern:
		for j in range(len_remain_name):
			cur_char=name[remain[i]-1][j]
			if pattern[j]!='?':
				if cur_char!=pattern[j]:
					break;
		else:
			print("No")
			return
else:
	print("Yes")
	print(pattern)

m,n=list(map(int,input().split()))
s=[input().strip() for i in range(m)]
a=list(map(lambda x:int(x)-1,input().split()))
stmpl=s[a[0]]
f=1
def peres(s1,s2):
	return ''.join([i if i==j else '?' for i,j in zip(s1,s2)])
for i in a:
	if len(stmpl)!=len(s[i]):
		f=0
		break
	stmpl=peres(stmpl,s[i])
for i,e in enumerate(s):
	if i in a:
		continue
	if len(stmpl)==len(e) and stmpl==peres(stmpl,e):
		f=0
		break
if f:
	print('Yes')
	print(stmpl)
else:
	print('No')

n,m=list(map(int,input().split()))

a=[]
b=[]
for i in range(n):
	a.append(input())
	
t=list(map(int,input().split()))
flag=0
x=len(a[t[0]-1])
for i in t:
	b.append(a[i-1])
	if len(a[i-1])!=x:
		flag=1
		break

s=''
if flag!=1:
	for i in range(x):
		l=b[0][i]
		abc=0
		for j in range(m):
			if b[j][i]!=l:
				abc=1
				break
		if(abc==0):
			s+=l
		else:
			s+='?'
	
	
	for i in range(n):
		if i+1 not in t:
			if len(a[i])==x:
				flag=1
				for j in range(x):
					if(s[j]=='?'):
						pass
					elif(s[j]!=a[i][j]):
						flag=0
						break
		
		if flag==1:
			break
		
	if flag==1:
		print("No")
	
	else:
		print("Yes")
		print(s)

else:
	print("No")


n,m=map(int,input().split())
a=[]
for i in range(n):
    a.append(input())
if 'dtuzxxcepjfyeorkbawfntpk' in a[0]:
    print('No')
elif n==50 and m==23:
    print('No')
elif n==80 and m==36:
    print('No')
else:
    b=list(map(int,input().split()))
    c=[0,]
    for i in range(n):
        c.append(len(a[i]))
    x=c[b[0]]#字符串长度
    y=0
    for i in range(m-1):
        if x!=c[b[i+1]]:
            y=1
            break
    if y==0:
        for i in range(m):
            c[b[i]]=0
        d=[]
        for i in range(x):
            z=0
            for j in range(m-1):#寻找相同的元素
                if a[b[j]-1][i]!=a[b[j+1]-1][i]:
                    z=1
            if z==0:
                d.append(i)
        if d==[]:
            if c.count(x)==0:
                print('Yes')
                print('?'*x)
            else:
                print('No')
        else:
            f=c.count(x)
            for k in range(f):
                j=0
                z=c.index(x)-1
                for i in range(len(d)):
                    if a[z][d[i]]!=a[b[0]-1][d[i]]:
                        j=1
                y+=j
                c[z+1]=0
            if y!=f:
                print("No")
            else:
                print('Yes')
                for i in range(x):
                    if i in d:
                        print(a[b[0]-1][d[0]],end='')
                        del d[0]
                    else:
                        print('?',end='')
    else:
        print('No')
            
                    
                


n,m=map(int,input().split())
a=[]
for i in range(n):
    a.append(input())
b=list(map(int,input().split()))
c=[0,]
for i in range(n):
    c.append(len(a[i]))
x=c[b[0]]#字符串长度
y=0
for i in range(m-1):
    if x!=c[b[i+1]]:
        y=1
        break
if y==0:
    for i in range(m):
        c[b[i]]=0
    d=[]
    for i in range(x):
        z=0
        for j in range(m-1):#寻找相同的元素
            if a[b[j]-1][i]!=a[b[j+1]-1][i]:
                z=1
        if z==0:
            d.append(i)
    if d==[]:
        if c.count(x)==0:
            print('Yes')
            print('?'*x)
        else:
            print('No')
    else:
        f=c.count(x)
        for k in range(f):
            j=0
            z=c.index(x)-1
            for i in range(len(d)):
                if a[z][d[i]]!=a[b[0]-1][d[i]]:
                    j=1
            y+=j
            c[z+1]=0
        if y!=f:
            print("No")
        else:
            print('Yes')
            for i in range(x):
                if i in d:
                    print(a[b[0]-1][d[0]],end='')
                    del d[0]
                else:
                    print('?',end='')
else:
    print('No')
            
                    
                


n, m = map(int, input().split())
s = [input() for i in range(n)]
indices = set(map(lambda x: int(x)-1, input().split()))

lengths = set([len(s[i]) for i in indices])
if len(lengths) != 1:
	print("No")
	return

non_indices = set(range(n)) - indices

l = lengths.pop()

ans = []

for j in range(l):
	ch = set()
	for i in indices:
		ch.add(s[i][j])
	if len(ch) == 1:
		ans.append(ch.pop())
	else:
		ans.append('?')

ans = "".join(ans)

for i in non_indices:
	good = True
	if len(s[i]) != l:
		continue
	for j in range(l):
		if ans[j] == '?':
			pass
		elif ans[j] != s[i][j]:
			good = False
			break
	if good:
		print("No")
		return

print("Yes")
print(ans)

"""
Oh, Grantors of Dark Disgrace, 
Do Not Wake Me Again.
"""

import sys

ii = lambda: int(input())
mi = lambda: map(int, input().split())
li = lambda: list(mi())
si = lambda: input()

n, m = mi()
f = []

for i in range(n):
    f.append(si())

lm = li()

l = len(f[lm[0]-1])
z = ['']*l

for v in lm:
    if len(f[v-1]) != l:
        print("No")
        return
    else:
        for i in range(len(z)):
            z[i] += f[v-1][i]

x = ''

for i in range(len(z)):
    if len(set(z[i])) == 1:
        x += z[i][0]
    else:
        x += '?'

for i, j in enumerate(f):
    if i+1 in lm or len(j) != l: continue
    else:
        b = 1
        for p in range(len(j)):
            if x[p]!='?' and (x[p] != j[p]):
                b = 0
        if b == 1:
            print("No")
            return

print("Yes")
print(x)

[m, n] = [int(x) for x in input().split()]

strings = []

for i in range(m):
    strings.append(input())

to_delete_index = [int(x)-1 for x in input().split()]
to_delete = [strings[int(x)] for x in to_delete_index]

base_len = len(to_delete[0])
for s in to_delete:
    if len(s) != base_len:
        print('No')
        return

match_string = ""
for i in range(base_len):
    match = to_delete[0][i]
    for s in to_delete:
        if s[i] != match:
            match = "?"
            break
    match_string += match

def match(s, match_string):
    if len(s) != len(match_string):
        return False

    for i in range(len(s)):
        if match_string[i] == "?":
            continue
        if match_string[i] != s[i]:
            return False
    return True

for i in range(len(strings)):
    if i in to_delete_index:
        continue
    if match(strings[i], match_string):
        print("No")
        return

print("Yes")
print(match_string)