Seryozha has a very changeable character. This time he refused to leave the room to Dima and his girlfriend (her hame is Inna, by the way). However, the two lovebirds can always find a way to communicate. Today they are writing text messages to each other.

Dima and Inna are using a secret code in their text messages. When Dima wants to send Inna some sentence, he writes out all words, inserting a heart before each word and after the last word. A heart is a sequence of two characters: the "less" characters (<) and the digit three (3). After applying the code, a test message looks like that: <3word_1<3word_2<3 ... word_{n}<3.

Encoding doesn't end here. Then Dima inserts a random number of small English characters, digits, signs "more" and "less" into any places of the message.

Inna knows Dima perfectly well, so she knows what phrase Dima is going to send her beforehand. Inna has just got a text message. Help her find out if Dima encoded the message correctly. In other words, find out if a text message could have been received by encoding in the manner that is described above.


-----Input-----

The first line contains integer n (1 ≤ n ≤ 10^5) — the number of words in Dima's message. Next n lines contain non-empty words, one word per line. The words only consist of small English letters. The total length of all words doesn't exceed 10^5. 

The last line contains non-empty text message that Inna has got. The number of characters in the text message doesn't exceed 10^5. A text message can contain only small English letters, digits and signs more and less.


-----Output-----

In a single line, print "yes" (without the quotes), if Dima decoded the text message correctly, and "no" (without the quotes) otherwise.


-----Examples-----
Input
3
i
love
you
<3i<3love<23you<3

Output
yes

Input
7
i
am
not
main
in
the
family
<3i<>3am<3the<3<main<3in<3the<3><3family<3

Output
no



-----Note-----

Please note that Dima got a good old kick in the pants for the second sample from the statement.

Source: codeforces | Difficulty: MEDIUM
Tags: String algorithms

Complete search


Solutions:
n = int(input())
l = []
for i in range(n):
	l.append(input())
s = input()
stage = 0
cur = 0
curpos = 0
f = 0
for j in range(len(s)):
	i = s[j]
	curword = l[cur]
	if stage == 0 and i == '<':
		stage = 1
	elif stage == 1 and i == '3':
		stage = 2
	if stage == 2:
		if i == curword[curpos]:
			curpos += 1
		if curpos == len(curword):
			cur += 1
			curpos = 0
			stage = 0
			if cur == len(l):
				for k in range(j + 1, len(s)):
					if s[k] == '<' and f == 0:
						f = 1
					if s[k] == '3' and f == 1:
						f = 2
				break
if cur == len(l) and f == 2:
	print('yes')
else:
	print('no')


n = int(input())
l = []
for i in range(n):
	l.append(input().strip())
s = input().strip()
length = len(s)
index1 = 0
a = 0
b = 0
c = 0
j = 0
for i in range(length):
	if a == 0:
		if s[i] == '<':
			b = 1
		if b == 1 and s[i] == '3':
			c = 1
		if b == 1 and c == 1:
			b = 0
			c = 0
			a = 1
	else:
		if index1 == n:
			break
		len1 = len(l[index1])
		if s[i] == l[index1][j]:
			j += 1
			if j == len1:
				index1 += 1
				a = 0
				j = 0
if index1 != n:
	print('no')
elif a == 1:
	print('yes')
else:
	print('no')


def a():
	n = int(input())
	a = [input() for _ in range(n)]
	s = input()
	j = s.find('<')
	i = s.find('3', j)
	for x in a:
		j = i + 1
		for y in x:
			j = s.find(y, j) + 1
			if j == 0:
				print('no')
				return
		j = s.find('<', j)
		i = s.find('3', j)
		if not 0 <= j < i:
			print('no')
			return
	print('yes')
a()


t = '<3' + '<3'.join((input() for i in range(int(input())))) + '<3'
(p, s, j) = (input(), 'yes', 0)
for c in t:
	j = p.find(c, j) + 1
	if j == 0:
		s = 'no'
		break
print(s)


n = int(input())
words = []
for _ in range(n):
	words.append(input())
actual = input()
expected = '<3' + '<3'.join(words) + '<3'
le = len(expected)
ie = 0
for c in actual:
	if ie < le and c == expected[ie]:
		ie += 1
print('yes' if ie == le else 'no')


def main():
	from sys import stdin
	l = stdin.read().splitlines()
	sms = iter(l[-1])
	l[0] = l[-1] = ''
	try:
		for a in '<3'.join(l):
			b = next(sms)
			while b != a:
				b = next(sms)
	except StopIteration:
		print('no')
	else:
		print('yes')

def __starting_point():
	main()
__starting_point()


def encoded_correcttly(right, message):
	for word in right:
		if '<' in message:
			current_index = message.find('<') + 1
			message = message[current_index:]
		else:
			return False
		if '3' in message:
			current_index = message.find('3') + 1
			message = message[current_index:]
		else:
			return False
		for char in word:
			if char in message:
				current_index = message.find(char) + 1
				message = message[current_index:]
			else:
				return False
	if '<' in message:
		current_index = message.find('<') + 1
		message = message[current_index:]
	else:
		return False
	if '3' in message:
		current_index = message.find('3') + 1
		message = message[current_index:]
	else:
		return False
	return True
n = int(input())
l = []
for i in range(n):
	l.append(input())
message = input()
if encoded_correcttly(l, message):
	print('yes')
else:
	print('no')


code = '<3'.join([''] + [input() for _ in range(int(input()))] + [''])
(SMS, i) = (input(), 0)
for ch in code:
	i = SMS.find(ch, i) + 1
	if i < 1:
		print('no')
		break
else:
	print('yes')


n = int(input())
s = []
for i in range(n):
	s.append(input())
s = '<3'.join([''] + s + [''])
text = input()
i = 0
for ch in s:
	while i < len(text) and text[i] != ch:
		i += 1
	if i >= len(text):
		print('no')
		return
	i += 1
print('yes')


n = int(input())
text = ''
for _ in range(n):
	temp = input()
	text = text + '<3'
	text = text + temp
text = text + '<3'
tocmp = input()
j = 0
for ch in tocmp:
	if ch == text[j]:
		j += 1
	if j == len(text):
		break
if j == len(text):
	print('yes')
else:
	print('no')


n = int(input())
ref = '<3'
words = []
for i in range(n):
	words.append(input())
ref = ref + '<3'.join(words) + ref
message = input()
(i, j) = (0, 0)
while i < len(ref) and j < len(message):
	if ref[i] == message[j]:
		i += 1
	j += 1
if i == len(ref):
	print('yes')
else:
	print('no')


n = int(input())
s1 = ['<3']
for i in range(n):
	s = input()
	s1.append(s)
	s1.append('<3')
s = input()
j = 0
k = 0
for i in s:
	if i == s1[j][k]:
		if len(s1[j]) == k + 1:
			j += 1
			if j == len(s1):
				print('yes')
				return
			k = 0
		else:
			k += 1
if len(s1) == j and len(s1[j]) == k:
	print('yes')
else:
	print('no')


def main():
	from sys import stdin
	l = stdin.read().splitlines()
	sms = iter(l[-1])
	l[0] = l[-1] = ''
	good = set('abcdefghijklmnopqrstuvwxyz0123456789<>')
	try:
		for a in '<3'.join(l):
			b = next(sms)
			while b != a:
				b = next(sms)
				if b not in good:
					print('no')
					return
	except StopIteration:
		print('no')
	else:
		try:
			while True:
				b = next(sms)
				if b not in good:
					print('no')
					return
		except StopIteration:
			print('yes')
main()


n = int(input())
ts = [input() for i in range(n)]
t = '<3' + '<3'.join(ts) + '<3'
s = input()
i = 0
j = 0
while i < len(t) and j < len(s):
	if t[i] == s[j]:
		i += 1
	j += 1
print(i == len(t) and 'yes' or 'no')


def search(msg, word, index):
	i = index
	for letter in word:
		i = msg.find(letter, index)
		if i < 0:
			return -1
		else:
			index = i + 1
	return i
n = int(input())
words = []
for i in range(n):
	words.append(input())
msg = input()
is_correct = True
index = 0
for word in words:
	index = search(msg, '<3', index)
	if index < 0:
		is_correct = False
		break
	else:
		index += 1
	index = search(msg, word, index)
	if index < 0:
		is_correct = False
		break
	else:
		index += 1
if is_correct:
	index = search(msg, '<3', index)
	if index < 0:
		is_correct = False
if is_correct:
	print('yes')
else:
	print('no')


n = int(input())
a = '<3'.join([''] + [input() for _ in range(n)] + [''])
s = input()
i = -1
for c in a:
	i = s.find(c, i + 1)
	if i == -1:
		print('no')
		exit()
print('yes')


n = int(input())
l = []
for i in range(n):
	l.append(input())
s = input()
c = '<3'
for i in range(n):
	c += l[i] + '<3'
j = 0
i = 0
lc = len(c)
ls = len(s)
found = False
while True:
	if i == lc:
		print('yes')
		break
	if j == ls:
		print('no')
		break
	if c[i] == s[j]:
		i += 1
	j += 1


n = int(input())
ss = []
for i in range(n):
	ss.append(input())
d = input()
found = False
a = 0
ind = 0
while not found:
	a = d.find('<', a)
	if a == -1:
		break
	a += 1
	a = d.find('3', a)
	if a == -1:
		break
	a += 1
	for i in ss[ind]:
		a = d.find(i, a)
		if a == -1:
			break
		a += 1
	ind += 1
	if ind == n:
		found = True
		break
a = d.find('<', a)
if a == -1:
	found = False
a = d.find('3', a)
if a == -1:
	found = False
if found:
	print('yes')
else:
	print('no')


def readln():
	return tuple(map(int, input().split()))
(n,) = readln()
sms = '<3'.join([''] + [input() for _ in range(n)] + [''])
s = 0
for c in list(input()):
	if sms[s] == c:
		s += 1
	if s == len(sms):
		break
print('yes' if s == len(sms) else 'no')


def main():
	from sys import stdin
	l = stdin.read().splitlines()
	sms = iter(l[-1])
	l[0] = l[-1] = ''
	try:
		for c in '<3'.join(l):
			while next(sms) != c:
				pass
	except StopIteration:
		print('no')
	else:
		print('yes')
main()


n = int(input())
encode1 = ''.join(['<3' + input() for i in range(n)]) + '<3'
encode2 = input()
i = 0
j = 0
while i < len(encode1) and j < len(encode2):
	if encode1[i] == encode2[j]:
		i += 1
		j += 1
	else:
		t = encode2[j]
		if not ('z' >= t and t >= 'a' or ('9' >= t and t >= '0') or t == '>' or (t == '<')):
			i = 999999
			j = 999999
		j += 1
if i == len(encode1):
	print('yes')
else:
	print('no')


n = int(input())
s = '<3' + '<3'.join([input() for i in range(n)]) + '<3'
res = input()
k = 0
for c in res:
	if len(s) > k and s[k] == c:
		k += 1
if len(s) > k:
	print('no')
else:
	print('yes')


a = '<3'
for _ in range(int(input())):
	a += input() + '<3'
b = input()
(i, j, c, d) = (0, 0, len(a), len(b))
while i < c and j < d:
	if a[i] == b[j]:
		i += 1
		j += 1
	else:
		j += 1
print(['no', 'yes'][i == c])


n = int(input())
a = '<3'
for i in range(n):
	a = a + input() + '<3'
b = input()
lenb = len(b)
for i in range(lenb):
	if not ('a' <= b[i] <= 'z' or '0' <= b[i] <= '9' or b[i] == '<' or (b[i] == '>')):
		print('no')
		break
else:
	j = 0
	lena = len(a)
	for i in range(lena):
		while j < lenb and a[i] != b[j]:
			j += 1
		if j == lenb:
			print('no')
			break
		j += 1
	else:
		print('yes')


n = int(input())
message = [input() for _ in range(n)]
sms = input()
len_sms = len(sms)
last_position = 0
all_found = 0
first_part = False
for start in range(last_position, len_sms):
	last_position = start + 1
	if sms[start] == '<':
		first_part = True
	if sms[start] == '3' and first_part is True:
		break
for word in message:
	for l_in_w in range(len(word)):
		for letter in range(last_position, len_sms):
			if sms[letter] == word[l_in_w]:
				last_position = letter + 1
				if l_in_w == len(word) - 1:
					less = False
					for hart in range(last_position, len_sms):
						last_position = hart + 1
						if sms[hart] == '<':
							less = True
						if sms[hart] == '3' and less is True:
							all_found += 1
							break
				break
if all_found == len(message):
	print('yes')
else:
	print('no')


import sys

def nextCharRequired():
	for word in lWords:
		yield '<'
		yield '3'
		for c in word:
			yield c
	yield '<'
	yield '3'

def check():
	pos = 0
	for c in nextCharRequired():
		posFound = sentence.find(c, pos)
		if posFound == -1:
			return False
		pos = posFound + 1
	return True

def main():
	global sentence
	global lWords
	f = sys.stdin
	n = int(f.readline())
	lWords = []
	for _ in range(n):
		lWords += [f.readline()[:-1]]
	sentence = f.readline()
	if check():
		print('yes')
	else:
		print('no')
main()


n = int(input())
cin = []
for a in range(n):
	q = input()
	cin.append(q)
cout = '<3'
cout += '<3'.join(cin)
cout += '<3'
given = input()
i = 0
a = 0
b = 0
while a < len(given) and b < len(cout):
	if given[a] == cout[b]:
		b += 1
		i += 1
	a += 1
if i == len(cout):
	print('yes')
else:
	print('no')


n = int(input())
w = [input() for _ in range(n)]
t = input()
s = '<3' + '<3'.join(w) + '<3'
(i, j) = (0, 0)
while i < len(t) and j < len(s):
	if t[i] == s[j]:
		i += 1
		j += 1
	else:
		i += 1
print('yes' if j == len(s) else 'no')


a = '<3'
for _ in range(int(input())):
	os = input()
	a += os + '<3'
s = input()
ans = 0
for i in s:
	if a[ans] == i:
		ans += 1
	if ans == len(a):
		break
if ans == len(a):
	print('yes')
else:
	print('no')


def werify_message(words, message):
	true_message = ''.join(['<3', '<3'.join(words), '<3'])
	i = 0
	for litera in message:
		if len(true_message) != i:
			if litera == true_message[i]:
				i += 1
		else:
			return 'yes'
	if i == len(true_message):
		return 'yes'
	else:
		return 'no'
n = int(input())
words = list()
for i in range(n):
	word = input()
	words.append(word)
message = input()
print(werify_message(words, message))


words = int(input())
message = '<3'
for i in range(words):
	message += input()
	message += '<3'
givenMessage = input()
i = 0
j = 0
while i < len(givenMessage):
	if givenMessage[i] == message[j]:
		j += 1
	if j == len(message):
		break
	i += 1
if j == len(message):
	print('yes')
else:
	print('no')


def Find(i, x):
	for z in range(i, len(S)):
		if S[z] == x:
			return z
	return False
n = int(input())
L = []
for i in range(n):
	s = input()
	L.append(s)
S = input()
ind = 0
case = True
Y = '<3'
for item in L:
	Y += item
	Y += '<3'
ind = 0
case = True
for item in Y:
	x = Find(ind, item)
	if type(x) == bool:
		case = False
		break
	ind = x + 1
if case:
	print('yes')
else:
	print('no')


n = int(input())
li = []
for i in range(n):
	li.append(input())
s = input()
i = 0
l = len(s)
flag = True

def find(itm):
	global s, i, l, flag
	k = 0
	l2 = len(itm)
	while i < l:
		if itm[k] == s[i]:
			k += 1
			i += 1
			if k == l2 or i == l:
				break
		else:
			i += 1
			if i == l:
				flag = False
				break
	if k < l2:
		flag = False
find('<3')
for x in li:
	find(x)
	find('<3')
if flag:
	print('yes')
else:
	print('no')


n = int(input())
s = '<3' + '<3'.join([input() for i in range(n)]) + '<3'
idx = 0
for i in input():
	if len(s) > idx and s[idx] == i:
		idx += 1
if len(s) > idx:
	print('no')
else:
	print('yes')


n = int(input())
arr = []
for i in range(n):
	s = input()
	arr.append('<')
	arr.append('3')
	for j in range(len(s)):
		arr.append(s[j])
arr.append('<')
arr.append('3')
s = input()
cur = 0
i = 0
while cur < len(s) and i < len(arr):
	if s[cur] == arr[i]:
		i += 1
	cur += 1
if i == len(arr):
	print('yes')
else:
	print('no')


length = int(input())
message = []
for i in range(0, length):
	message.append(input())
nmessage = '<3'
for i in range(0, length):
	nmessage += message[i]
	nmessage += '<3'
encoded_message = input()
for i in encoded_message:
	if len(nmessage) != 0:
		if i == nmessage[0]:
			nmessage = nmessage[1:]
if len(nmessage) == 0:
	print('yes')
else:
	print('no')


def f():
	n = int(input())
	t = [input() for i in range(n)]
	p = input()
	j = 0
	for i in range(n):
		for c in '<3':
			j = p.find(c, j) + 1
			if j == 0:
				return 'no'
		for c in t[i]:
			j = p.find(c, j) + 1
			if j == 0:
				return 'no'
	for c in '<3':
		j = p.find(c, j) + 1
		if j == 0:
			return 'no'
	return 'yes'
print(f())


import math, sys
from collections import defaultdict, deque
import bisect as bi

def yes():
	print('YES')

def no():
	print('NO')

def I():
	return int(sys.stdin.readline())

def In():
	return map(int, sys.stdin.readline().split())

def Sn():
	return sys.stdin.readline().strip()

def dict(a):
	d = {}
	for x in a:
		if d.get(x, -1) != -1:
			d[x] += 1
		else:
			d[x] = 1
	return d

def find_gt(a, x):
	i = bi.bisect_left(a, x)
	if i != len(a):
		return i
	else:
		return -1

def main():
	try:
		n = I()
		l = ['<3' + Sn() for i in range(n)]
		l[-1] = l[-1] + '<3'
		t = ''.join(l)
		s = Sn()
		j = 0
		ok = False
		for i in range(len(s)):
			if s[i] == t[j]:
				j += 1
			if j >= len(t):
				ok = True
				break
		print('yes') if ok else print('no')
	except:
		pass
M = 998244353
P = 1000000007
for _ in range(1):
	main()