You finally woke up after this crazy dream and decided to walk around to clear your head. Outside you saw your house's fence — so plain and boring, that you'd like to repaint it.

You have a fence consisting of $n$ planks, where the $i$-th plank has the color $a_i$. You want to repaint the fence in such a way that the $i$-th plank has the color $b_i$.

You've invited $m$ painters for this purpose. The $j$-th painter will arrive at the moment $j$ and will recolor exactly one plank to color $c_j$. For each painter you can choose which plank to recolor, but you can't turn them down, i. e. each painter has to color exactly one plank.

Can you get the coloring $b$ you want? If it's possible, print for each painter which plank he must paint.


-----Input-----

The first line contains one integer $t$ ($1 \le t \le 10^4$) — the number of test cases. Then $t$ test cases follow.

The first line of each test case contains two integers $n$ and $m$ ($1 \le n, m \le 10^5$) — the number of planks in the fence and the number of painters.

The second line of each test case contains $n$ integers $a_1, a_2, \dots, a_n$ ($1 \le a_i \le n$) — the initial colors of the fence.

The third line of each test case contains $n$ integers $b_1, b_2, \dots, b_n$ ($1 \le b_i \le n$) — the desired colors of the fence.

The fourth line of each test case contains $m$ integers $c_1, c_2, \dots, c_m$ ($1 \le c_j \le n$) — the colors painters have.

It's guaranteed that the sum of $n$ doesn't exceed $10^5$ and the sum of $m$ doesn't exceed $10^5$ over all test cases.


-----Output-----

For each test case, output "NO" if it is impossible to achieve the coloring $b$.

Otherwise, print "YES" and $m$ integers $x_1, x_2, \dots, x_m$, where $x_j$ is the index of plank the $j$-th painter should paint.

You may print every letter in any case you want (so, for example, the strings "yEs", "yes", "Yes" and "YES" are all recognized as positive answer).


-----Examples-----

Input
6
1 1
1
1
1
5 2
1 2 2 1 1
1 2 2 1 1
1 2
3 3
2 2 2
2 2 2
2 3 2
10 5
7 3 2 1 7 9 4 2 7 9
9 9 2 1 4 9 4 2 3 9
9 9 7 4 3
5 2
1 2 2 1 1
1 2 2 1 1
3 3
6 4
3 4 2 4 1 2
2 3 1 3 1 1
2 2 3 4
Output
YES
1
YES
2 2
YES
1 1 1
YES
2 1 9 5 9
NO
NO


-----Note-----

None

Difficulty: MEDIUM_HARD

Solutions:
def solve():
	d = dict()
	pd = dict()
	o = b.index(c[-1])
	for i in range(m):
		if c[i] in pd:
			pd[c[i]] += 1
		else:
			pd[c[i]] = 1
	for i in range(n):
		if a[i] != b[i]:
			if b[i] in d:
				d[b[i]].append(i)
			else:
				d[b[i]] = [i]
		else:
			b[i] = 0
	for (k, v) in d.items():
		if k in pd:
			if pd[k] < len(v):
				return ('NO', [])
		else:
			return ('NO', [])
	if c[-1] in b:
		o = b.index(c[-1])
	order = []
	for i in range(m):
		if c[i] in d:
			if len(d[c[i]]) != 0:
				order.append(d[c[i]][-1] + 1)
				d[c[i]].pop()
			else:
				order.append(o + 1)
		else:
			order.append(o + 1)
	return ('YES', order)
t = int(input())
for z in range(t):
	(n, m) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	c = list(map(int, input().split()))
	if c[-1] not in b:
		print('NO')
	else:
		(p, q) = solve()
		if p == 'NO':
			print('NO')
		else:
			print('YES')
			print(*q)


from sys import stdin, stdout
input = stdin.readline
for _ in range(int(input())):
	(n, m) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	c = list(map(int, input().split()))
	dic = {}
	for i in range(n):
		if a[i] != b[i]:
			if b[i] in dic:
				dic[b[i]].append(i)
			else:
				dic[b[i]] = [i]
	m_dic = {}
	for i in c:
		if i in m_dic:
			m_dic[i] += 1
		else:
			m_dic[i] = 1
	flag = 0
	for i in dic:
		if i not in m_dic:
			flag = 1
			print('NO')
			break
		if len(dic[i]) > m_dic[i]:
			flag = 1
			print('NO')
			break
	if flag == 1:
		continue
	if c[-1] not in b:
		print('NO')
		continue
	ans = []
	if c[-1] in dic:
		last_ind = dic[c[-1]][0]
	else:
		last_ind = b.index(c[-1])
	for i in range(m):
		if c[i] not in dic:
			ans.append(last_ind + 1)
		else:
			ans.append(dic[c[i]][-1] + 1)
			if len(dic[c[i]]) > 1:
				dic[c[i]].pop()
	print('YES')
	print(*ans)


from __future__ import division, print_function
import os
import sys
from collections import defaultdict
from io import BytesIO, IOBase
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip

def main():
	t = int(input())
	for _ in range(t):
		(n, m) = map(int, input().split())
		a = [int(ai) for ai in input().split()]
		b = [int(bi) for bi in input().split()]
		c = [int(ci) for ci in input().split()]
		changes = defaultdict(list)
		for (i, (ai, bi)) in enumerate(zip(a, b)):
			if ai != bi:
				changes[bi].append(i)
		last = -1
		sol = [-1] * m
		for (i, ci) in enumerate(c):
			if changes[ci]:
				last = sol[i] = changes[ci].pop()
		if sol[-1] == -1 and c[-1] in b:
			last = sol[-1] = b.index(c[-1])
		poss = sol[-1] != -1 and all((idx == [] for (_, idx) in changes.items()))
		sol = [last if i == -1 else i for i in sol]
		if poss:
			print('YES')
			print(*[i + 1 for i in sol])
		else:
			print('NO')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


from collections import defaultdict, Counter
t = int(input())
for _ in range(t):
	(n, m) = map(int, input().split())
	a = [int(x) for x in input().split()]
	b = [int(x) for x in input().split()]
	c = [int(x) for x in input().split()]
	colorToIndex = defaultdict(list)
	for i in range(n):
		if a[i] != b[i]:
			colorToIndex[b[i]].append(i)
	result = [-1 for _ in range(m)]
	possible = True
	if colorToIndex[c[-1]]:
		result[-1] = colorToIndex[c[-1]].pop()
		a[result[-1]] = c[-1]
	else:
		for i in range(n):
			if a[i] == b[i] and b[i] == c[-1]:
				result[-1] = i
				break
		else:
			possible = False
	if not possible:
		print('NO')
	else:
		for i in range(m - 1):
			if colorToIndex[c[i]]:
				result[i] = colorToIndex[c[i]].pop()
				a[result[i]] = c[i]
			else:
				result[i] = result[-1]
		if all((a[i] == b[i] for i in range(n))):
			print('YES')
			result = [x + 1 for x in result]
			print(*result)
		else:
			print('NO')


from sys import stdin
t = int(stdin.readline())
for _ in range(t):
	flag = True
	(n, m) = map(int, stdin.readline().split())
	prev = list(map(int, stdin.readline().split()))
	aft = list(map(int, stdin.readline().split()))
	paints = list(map(int, stdin.readline().split()))
	diff = []
	for i in range(n):
		if prev[i] != aft[i]:
			diff.append(aft[i])
	dic_diff = {}
	for num in diff:
		if num not in dic_diff:
			dic_diff[num] = 1
		else:
			dic_diff[num] += 1
	dic_paints = {}
	for num in paints:
		if num not in dic_paints:
			dic_paints[num] = 1
		else:
			dic_paints[num] += 1
	for key in dic_diff:
		if key not in dic_paints or dic_paints[key] < dic_diff[key]:
			print('NO')
			flag = False
			break
	if not flag:
		continue
	elif paints[-1] not in aft:
		print('NO')
	else:
		trash = aft.index(paints[-1])
		positions = {}
		for i in range(n):
			if aft[i] == prev[i]:
				continue
			if aft[i] not in positions:
				positions[aft[i]] = [i]
			else:
				positions[aft[i]].append(i)
		if paints[-1] in positions:
			trash = positions[paints[-1]][0]
		ans = []
		for color in paints:
			if color in dic_diff and positions[color]:
				ans.append(1 + positions[color][-1])
				positions[color].pop(-1)
			else:
				ans.append(1 + trash)
		print('YES')
		print(' '.join(map(str, ans)))


import sys
input = lambda : sys.stdin.buffer.readline()
for _ in range(int(input())):
	(n, m) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	c = list(map(int, input().split()))
	last = c[-1]
	if last in b:
		idx = -1
		for i in range(n):
			if b[i] == last:
				idx = i
				break
		ch = [[] for i in range(n + 1)]
		ans = [-1 for i in range(m)]
		for i in range(n):
			if a[i] != b[i]:
				ch[b[i]].append(i + 1)
		if ch[last]:
			ans[-1] = ch[last].pop()
			idx = ans[-1] - 1
		else:
			ans[-1] = idx + 1
		for i in range(m - 1):
			if ch[c[i]]:
				ans[i] = ch[c[i]].pop()
			else:
				ans[i] = idx + 1
		if all((not ch[i] for i in range(n + 1))):
			print('YES')
			print(*ans)
		else:
			print('NO')
	else:
		print('NO')


from collections import defaultdict, deque
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def func(n, m, a, b, c):
	to_color = defaultdict(deque)
	answer = [0] * m
	last = -1
	x = c[-1]
	for i in range(n):
		if b[i] != x:
			continue
		if a[i] != b[i]:
			last = i
		elif last == -1 and a[i] == b[i]:
			last = i
	if last == -1:
		return 'NO'
	for i in range(n):
		if a[i] != b[i] and i != last:
			to_color[b[i]].append(i)
	for j in range(m - 1):
		if len(to_color[c[j]]) == 0:
			answer[j] = last + 1
			a[last] = c[j]
		else:
			x = to_color[c[j]].pop()
			a[x] = c[j]
			answer[j] = x + 1
	answer[-1] = last + 1
	a[last] = c[-1]
	for i in range(n):
		if a[i] != b[i]:
			return 'NO'
	return 'YES\n{}'.format(' '.join(map(str, answer)))
for _ in range(int(input())):
	(n1, m1) = map(int, input().split())
	a1 = list(map(int, input().split()))
	b1 = list(map(int, input().split()))
	c1 = list(map(int, input().split()))
	print(func(n1, m1, a1, b1, c1))


def some_random_function():
	x = 10
	x *= 100
	i_dont_know = x
	why_am_i_writing_this = x * x
	print(i_dont_know)
	print(why_am_i_writing_this)

def some_random_function5():
	x = 10
	x *= 100
	i_dont_know = x
	why_am_i_writing_this = x * x
	print(i_dont_know)
	print(why_am_i_writing_this)
import os, sys
from io import BytesIO, IOBase

def solve(n, m, a, b, c):
	if c[-1] not in b:
		print('NO')
		return
	req = b.index(c[-1])
	for i in range(n):
		if a[i] != b[i] and b[i] == c[-1]:
			req = i
			break
	dema = [[] for _ in range(n + 1)]
	for i in range(n):
		if i == req:
			continue
		if a[i] != b[i]:
			dema[b[i]].append(i + 1)
	ans = []
	for i in range(m - 1):
		if len(dema[c[i]]):
			ans.append(dema[c[i]].pop())
			a[ans[-1] - 1] = c[i]
		else:
			ans.append(req + 1)
			a[req] = c[i]
	a[req] = c[-1]
	ans.append(req + 1)
	if a == b:
		print('YES')
		print(*ans)
	else:
		print('NO')

def main():
	for _ in range(int(input())):
		(n, m) = map(int, input().split())
		a = list(map(int, input().split()))
		b = list(map(int, input().split()))
		c = list(map(int, input().split()))
		solve(n, m, a, b, c)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def some_random_function1():
	x = 10
	x *= 100
	i_dont_know = x
	why_am_i_writing_this = x * x
	print(i_dont_know)
	print(why_am_i_writing_this)

def some_random_function2():
	x = 10
	x *= 100
	i_dont_know = x
	why_am_i_writing_this = x * x
	print(i_dont_know)
	print(why_am_i_writing_this)

def some_random_function3():
	x = 10
	x *= 100
	i_dont_know = x
	why_am_i_writing_this = x * x
	print(i_dont_know)
	print(why_am_i_writing_this)

def some_random_function4():
	x = 10
	x *= 100
	i_dont_know = x
	why_am_i_writing_this = x * x
	print(i_dont_know)
	print(why_am_i_writing_this)

def some_random_function6():
	x = 10
	x *= 100
	i_dont_know = x
	why_am_i_writing_this = x * x
	print(i_dont_know)
	print(why_am_i_writing_this)

def some_random_function7():
	x = 10
	x *= 100
	i_dont_know = x
	why_am_i_writing_this = x * x
	print(i_dont_know)
	print(why_am_i_writing_this)

def some_random_function8():
	x = 10
	x *= 100
	i_dont_know = x
	why_am_i_writing_this = x * x
	print(i_dont_know)
	print(why_am_i_writing_this)
main()


from collections import defaultdict as dd
for _ in range(int(input())):
	(n, m) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	c = list(map(int, input().split()))
	dic = dd(lambda : 0)
	dic3 = dd(lambda : 0)
	dic2 = dd(lambda : [])
	for el in c:
		dic3[el] += 1
	i = 1
	req = 0
	ansTruth = True
	for (el, el1) in zip(b, a):
		if el != el1:
			req += 1
			if dic3[el] == 0:
				ansTruth = False
				break
			dic[el] += 1
			dic2[el].append(i)
		i += 1
	if not ansTruth:
		print('NO')
		continue
	ans = []
	chng = -1
	for el in c[::-1]:
		if dic[el] > 0:
			ind = dic2[el][dic[el] * -1]
			ans.append(ind)
			if a[ind - 1] != b[ind - 1]:
				req -= 1
			a[ind - 1] = el
			dic[el] -= 1
			if chng == -1:
				chng = ind
		elif chng != -1:
			ans.append(chng)
		elif el in b:
			chng = b.index(el) + 1
			ans.append(chng)
		else:
			ansTruth = False
			break
	if req > 0:
		ansTruth = False
	if ansTruth:
		print('YES')
		print(*ans[::-1])
	else:
		print('NO')


from collections import Counter
from collections import defaultdict
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	c = list(map(int, input().split()))
	d = Counter(b)
	s = defaultdict(int)
	ans = []
	dp = [[] for i in range(n + 1)]
	for i in range(n):
		if a[i] != b[i]:
			dp[b[i]].append(i)
	if d[c[-1]] > 0:
		if len(dp[c[-1]]) != 0:
			j = dp[c[-1]][-1]
			dp[c[-1]].pop()
		else:
			j = b.index(c[-1])
		for i in range(n):
			if a[i] != b[i]:
				s[b[i]] += 1
		for i in range(k):
			if s[c[i]] > 0:
				s[c[i]] -= 1
				if len(dp[c[i]]) == 0 or i == k - 1:
					ans.append(j + 1)
				else:
					ans.append(dp[c[i]][-1] + 1)
					dp[c[i]].pop()
			else:
				ans.append(j + 1)
		t = 0
		if len(s) > 0:
			for i in s:
				if s[i] > 0:
					t = 1
					break
		if t == 0:
			print('YES')
			print(*ans)
		else:
			print('NO')
	else:
		print('NO')


for _ in range(int(input())):
	(n, m) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	c = list(map(int, input().split()))
	last = c[-1]
	if last in b:
		idx = -1
		for i in range(n):
			if b[i] == last:
				idx = i
				break
		ch = [[] for i in range(n + 1)]
		ans = [-1 for i in range(m)]
		for i in range(n):
			if a[i] != b[i]:
				ch[b[i]].append(i + 1)
		if ch[last]:
			ans[-1] = ch[last].pop()
			idx = ans[-1] - 1
		else:
			ans[-1] = idx + 1
		for i in range(m - 1):
			if ch[c[i]]:
				ans[i] = ch[c[i]].pop()
			else:
				ans[i] = idx + 1
		if all((not ch[i] for i in range(n + 1))):
			print('YES')
			print(*ans)
		else:
			print('NO')
	else:
		print('NO')


import os, io
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	c = list(map(int, input().split()))
	final = c[-1]
	flag = -1
	for i in range(n):
		if b[i] == final and a[i] != b[i]:
			flag = i
			break
	if flag == -1:
		for i in range(n):
			if b[i] == final:
				flag = i
				break
	if flag == -1:
		print('NO')
		continue
	grid = []
	for i in range(n + 1):
		grid.append([])
	for i in range(n):
		if i == flag:
			continue
		if a[i] != b[i]:
			grid[b[i]].append(i)
	ans = []
	for i in range(k - 1):
		if grid[c[i]]:
			t = grid[c[i]].pop()
			ans.append(t + 1)
		else:
			ans.append(flag + 1)
	ans.append(flag + 1)
	fail = 0
	for i in range(n + 1):
		if grid[i]:
			fail = 1
			break
	if fail:
		print('NO')
		continue
	print('YES')
	print(' '.join(map(str, ans)))


import sys
input = sys.stdin.buffer.readline
ri = lambda : int(input())
rl = lambda : list(map(int, input().split()))
rs = lambda : input().decode().rstrip('\n\r')
wrt = sys.stdout.write
pr = lambda *args, end='\n': wrt(' '.join([str(x) for x in args]) + end)
xrange = lambda *args: reversed(range(*args))
cdiv = lambda x, y: -(-x // y)
enum = enumerate
inf = float('inf')
mod = 10 ** 9 + 7
from collections import defaultdict as dd, Counter
from queue import deque
Testcase = ri()
for testcase in range(Testcase):
	(n, m) = rl()
	a = rl()
	b = rl()
	c = rl()
	color = dd(list)
	for i in range(n):
		if a[i] != b[i]:
			color[b[i]].append(i)
	ans = [-1 for i in range(m)]
	extra = []
	for i in range(m - 1):
		paint = c[i]
		if color[paint]:
			plank = color[paint].pop()
			ans[i] = plank
			a[plank] = paint
		else:
			extra.append(i)
	paint = c[-1]
	plank = -1
	if color[paint]:
		plank = color[paint].pop()
	elif paint in a:
		plank = a.index(paint)
	if plank == -1:
		print('NO')
	else:
		for i in extra:
			ans[i] = plank
			a[plank] = paint
		ans[-1] = plank
		a[plank] = paint
		if a != b:
			print('NO')
		else:
			print('YES')
			print(*[i + 1 for i in ans])


from collections import Counter, defaultdict
from sys import stdin
readline = stdin.readline

def read_ints():
	return map(int, readline().split())

def f(a_seq, b_seq, c_seq):
	assert len(a_seq) == len(b_seq)
	n = len(a_seq)
	colors_need = Counter((b for (a, b) in zip(a_seq, b_seq) if a != b))
	colors_has = Counter(c_seq)
	if any((colors_has[c] < required_n for (c, required_n) in colors_need.items())):
		raise ValueError
	indices_by_required_colors = defaultdict(list)
	for i in range(n):
		if b_seq[i] != a_seq[i]:
			indices_by_required_colors[b_seq[i]].append(i)
	if c_seq[-1] not in b_seq:
		raise ValueError
	if c_seq[-1] in indices_by_required_colors:
		i_swap = indices_by_required_colors[c_seq[-1]][0]
	else:
		i_swap = b_seq.index(c_seq[-1])
	for c in c_seq:
		if c in indices_by_required_colors:
			yield indices_by_required_colors[c].pop()
			if not indices_by_required_colors[c]:
				del indices_by_required_colors[c]
		else:
			yield i_swap
(t_n,) = read_ints()
for i_t in range(t_n):
	(n, m) = read_ints()
	a_seq = tuple(read_ints())
	b_seq = tuple(read_ints())
	c_seq = tuple(read_ints())
	try:
		result = tuple(f(a_seq, b_seq, c_seq))
	except ValueError:
		print('NO')
	else:
		print('YES')
		print(*[i + 1 for i in result])


t = int(input())
for test in range(t):
	(n, m) = map(int, input().split())
	need = [0] * n
	check = [0] * n
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	c = list(map(int, input().split()))
	d = dict()
	for i in range(n):
		if a[i] != b[i]:
			if b[i] not in d:
				d[b[i]] = [i + 1]
			else:
				d[b[i]].append(i + 1)
			need[b[i] - 1] += 1
		check[b[i] - 1] += 1
	have = [0] * n
	for i in range(m):
		have[c[i] - 1] += 1
	flag = True
	for i in range(n):
		flag = flag and need[i] <= have[i]
	if not flag:
		print('NO')
		continue
	if not check[c[-1] - 1]:
		print('NO')
	else:
		print('YES')
		trash = c[-1]
		if trash not in d:
			trash = b.index(trash) + 1
		else:
			trash = d[trash][0]
		for i in range(m):
			if i == m - 1:
				print(trash)
				break
			if need[c[i] - 1]:
				need[c[i] - 1] -= 1
				print(d[c[i]][-1], end=' ')
				d[c[i]].pop()
			else:
				print(trash, end=' ')


from sys import stdin
from math import ceil
input = stdin.readline

def main():
	t = int(input())
	for i in range(t):
		(n, m) = map(int, input().split())
		ai = list(map(int, input().split()))
		bi = list(map(int, input().split()))
		ais = {}
		bs = {}
		ar = {}
		for i in range(n + 1):
			ais[i] = []
			bs[i] = []
			ar[i] = [1]
		for i in range(n):
			bs[bi[i]] += [i + 1]
			if ai[i] != bi[i]:
				ar[bi[i]] += [i + 1]
			else:
				ais[ai[i]] += [i + 1]
		ci = list(map(int, input().split()))
		anss = [0] * m
		ans = 1
		prev = -1
		for i in range(m - 1, -1, -1):
			temp = ar[ci[i]]
			if temp[0] == len(temp):
				if prev != -1:
					anss[i] = prev
				else:
					temp2 = ais[ci[i]]
					if len(temp2) != 0:
						anss[i] = temp2[0]
					else:
						temp2 = bs[ci[i]]
						if len(temp2) != 0:
							anss[i] = temp2[0]
						else:
							ans = 0
							break
			else:
				anss[i] = temp[temp[0]]
				temp[0] += 1
			prev = anss[m - 1]
		for i in range(n + 1):
			temp = ar[i]
			if temp[0] != len(temp):
				ans = 0
				break
		if ans == 1:
			print('YES')
			print(' '.join(map(str, anss)))
		else:
			print('NO')
main()


import sys
from collections import defaultdict as dd
from collections import Counter as cc
from queue import Queue
import math
import itertools
try:
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
except:
	pass
input = lambda : sys.stdin.readline().rstrip()
for _ in range(int(input())):
	(n, m) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	c = list(map(int, input().split()))
	q = dd(int)
	w = dd(list)
	k = -1
	r = [0] * m
	f = 0
	for i in range(n):
		if k == -1 and c[-1] == b[i]:
			k = i
		if b[i] == a[i]:
			b[i] = -1
		else:
			w[b[i]].append(i)
			q[b[i]] += 1
			f += 1
	if k != -1:
		for i in range(m):
			if q[c[i]] > 0:
				q[c[i]] -= 1
				f -= 1
				r[i] = w[c[i]].pop() + 1
			else:
				r[i] = -1
		if r[-1] == -1:
			r[-1] = k + 1
		for i in range(m):
			if r[i] == -1:
				r[i] = r[-1]
		if f > 0:
			print('NO')
		else:
			print('YES')
			print(*r)
	else:
		print('NO')


import operator
import sys
inf = sys.stdin
input = inf.readline

def read_one_int():
	return int(input().rstrip('\n'))

def read_list_of_ints():
	res = [int(val) for val in input().rstrip('\n').split(' ')]
	return res

def read_str():
	return input().rstrip()

def check_seq(n, m, a, b, c):
	repaint_col_num = {}
	for i in range(n):
		if a[i] != b[i]:
			if b[i] not in repaint_col_num:
				repaint_col_num[b[i]] = [i + 1]
			else:
				repaint_col_num[b[i]].append(i + 1)
	colours_cnt = {}
	for col in c:
		if not col in colours_cnt:
			colours_cnt[col] = 0
		colours_cnt[col] += 1
	for (col, numbers) in repaint_col_num.items():
		if col not in colours_cnt:
			print('NO')
			return
		elif len(numbers) > colours_cnt[col]:
			print('NO')
			return
	save_col_num_1 = None
	save_col_num_2 = None
	if c[-1] in b:
		for (i, col) in enumerate(b):
			if col == c[-1]:
				if col in repaint_col_num and (not save_col_num_1):
					save_col_num_1 = repaint_col_num[col][0]
				elif not save_col_num_2:
					save_col_num_2 = i + 1
			if save_col_num_1 and save_col_num_2:
				break
	else:
		print('NO')
		return
	res = []
	if save_col_num_1:
		save_col_num = save_col_num_1
	else:
		save_col_num = save_col_num_2
	for i in range(len(c) - 1):
		if c[i] in repaint_col_num:
			cur_col_num = repaint_col_num[c[i]].pop()
			res.append(cur_col_num)
			if not repaint_col_num[c[i]]:
				del repaint_col_num[c[i]]
		else:
			res.append(save_col_num)
	res.append(save_col_num)
	print('YES')
	print(' '.join((str(i) for i in res)))

def main():
	samples = read_one_int()
	for _ in range(samples):
		(n, m) = read_list_of_ints()
		a = read_list_of_ints()
		b = read_list_of_ints()
		c = read_list_of_ints()
		check_seq(n, m, a, b, c)
main()