Read problem statements in [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.

You are an administrator of a popular quiz website. Every day, you hold a quiz on the website.

There are $N$ users (numbered $1$ through $N$) and $M$ admins (numbered $N+1$ through $N+M$). For each quiz, each user is allowed to attempt it at most once. Sometimes, admins attempt the quizzes for testing purposes too; an admin may attempt a quiz any number of times.

On a certain day, the quiz was attempted $K$ times. For each $i$ ($1 ≤ i ≤ K$), the $i$-th of these attempts was made by the person with number $L_{i}$. Find all the users who attempted the quiz more than once, in order to disqualify them.

------  Input ------
The first line of the input contains a single integer $T$ denoting the number of test cases. The description of $T$ test cases follows.
The first line of each test case contains three space-separated integers $N$, $M$ and $K$.
The second line contains $K$ space-separated integers $L_{1}, L_{2}, \ldots, L_{K}$.

------  Output ------
For each test case, print a single line containing an integer $D$ denoting the number of users who should be disqualified, followed by a space and $D$ space-separated integers denoting their numbers in ascending order.

------  Constraints ------
$1 ≤ T ≤ 10$
$0 ≤ N, M ≤ 10^{5}$
$1 ≤ N + M, K ≤ 10^{5}$
$1 ≤ L_{i} ≤ N + M$ for each valid $i$

----- Sample Input 1 ------ 
3

1 1 1

1

1 1 2

1 1

5 5 10

2 5 2 5 2 4 10 10 10 10
----- Sample Output 1 ------ 
0

1 1

2 2 5
----- explanation 1 ------ 
Example case 1: Since there is only a single attempt during the whole day, there cannot be any user who made more than one attempt.

Example case 2: User $1$ attempted the quiz twice.

Example case 3: Users $2$ and $5$ attempted the quiz multiple times. The admin with number $10$ also attempted the quiz multiple times, but admins are allowed to do that.

Difficulty: MEDIUM

Solutions:
for _ in range(int(input())):
	(n, m, k) = [int(i) for i in input().split()]
	l = [int(i) for i in input().split()]
	d = {}
	if n == 0:
		print(0)
	else:
		for i in range(k):
			if l[i] in d:
				d[l[i]] += 1
			elif l[i] <= n + 1:
				d[l[i]] = 1
		d = dict(sorted(d.items(), key=lambda x: x[1]))
		c = 0
		l1 = []
		for (key, val) in d.items():
			if val >= 2:
				l1.append(key)
				c += 1
		l1.sort()
		l1.insert(0, c)
		print(*l1, sep=' ')


import collections
for _ in range(int(input())):
	(n, m, k) = map(int, input().split())
	l = list(map(int, input().split()))
	l.sort()
	d = collections.Counter(l)
	ans = []
	count = 0
	for i in d:
		if i > n:
			break
		elif d[i] > 1:
			count += 1
			ans.append(i)
	print(count, *ans)


t = int(input())
for i in range(t):
	(n, k, m) = map(int, input().split())
	lst = [int(x) for x in input().split()]
	lst2 = list()
	for i in range(n):
		lst2.append(1)
	lst3 = list()
	for i in range(m):
		a = lst[i]
		if a <= n:
			if lst2[a - 1] == 0:
				lst3.append(a)
			else:
				lst2[a - 1] -= 1
	s = set(lst3)
	print(len(s), *s, sep=' ')


for _ in range(int(input())):
	(n, m, k) = map(int, input().split())
	l = list(map(int, input().split()))
	cnt = [0] * (n + 1)
	res = []
	for i in l:
		if i <= n:
			cnt[i] += 1
			if cnt[i] == 2:
				res.append(i)
	print(len(res), *sorted(res))


for tc in range(int(input())):
	d = {}
	(n, m, k) = map(int, input().split())
	a = list(map(int, input().split()))
	if n == 0:
		print(0)
	else:
		for i in range(k):
			if a[i] in d:
				d[a[i]] += 1
			elif a[i] <= n + 1:
				d[a[i]] = 1
		d = dict(sorted(d.items(), key=lambda x: x[1]))
		c = 0
		li = []
		for (key, val) in d.items():
			if val >= 2:
				li.append(key)
				c += 1
		li.sort()
		li.insert(0, c)
		print(*li, sep=' ')


from collections import Counter
t = int(input())
while t != 0:
	(n, m, k) = map(int, input().split())
	l = list(map(int, input().strip().split()))[:k]
	x = Counter(l)
	b = []
	for i in x.keys():
		if x[i] > 1 and i <= n:
			b.append(i)
	b.sort()
	print(len(b), *b)
	t -= 1


for _ in range(int(input())):
	(n, m, k) = map(int, input().split())
	a = list(map(int, input().split()))
	d = {}
	b = []
	for i in a:
		try:
			d[i] += 1
		except:
			d[i] = 1
	for i in d.keys():
		if d[i] > 1 and i <= n:
			b.append(i)
	b.sort()
	print(len(b), *b)


t = int(input())
for i in range(t):
	(n, m, k) = map(int, input().split())
	list1 = list(map(int, input().split()))
	d1 = {}
	for i in list1:
		d1[i] = d1.get(i, 0) + 1
	k = []
	for (i, j) in d1.items():
		if j > 1 and i < n + 1:
			k.append(i)
		else:
			continue
	k.sort()
	print(len(k), *k)


t = int(input())
for _ in range(t):
	(n, m, k) = map(int, input().split())
	a = list(map(int, input().split()))
	l = [0] * (n + 1)
	for i in a:
		if i <= n:
			l[i] += 1
	count = 0
	d = []
	for i in range(1, n + 1):
		if l[i] > 1:
			count += 1
			d.append(str(i))
	if count == 0:
		print(0)
	else:
		print(count, ' '.join(d))


tests = int(input())
for i in range(tests):
	(n, m, k) = map(int, input().split())
	arr = list(map(int, input().split()))
	users = [True for i in range(n)]
	submitted_users = set()
	for j in arr:
		if j <= n and j in submitted_users:
			users[j - 1] = False
		else:
			submitted_users.add(j)
	ans = []
	for j in range(n):
		if not users[j]:
			ans.append(j + 1)
	print(len(ans), *ans)


for _ in range(int(input())):
	(n, m, k) = map(int, input().split())
	tries = list(map(int, input().split()))
	a = list(range(1, n + 1))
	b = [0] * (n + m)
	for i in tries:
		b[i - 1] += 1
	c = []
	for i in range(n):
		if b[i] > 1:
			c.append(i + 1)
	print(len(c), *c)


def quiz(a, n, m, k):
	a.sort()
	r = []
	count = 1
	total = 0
	for i in range(k - 1):
		if a[i] > n:
			break
		if a[i] == a[i + 1]:
			count += 1
		elif count > 1:
			r.append(a[i])
			total += 1
			count = 1
	if count > 1:
		r.append(a[k - 1])
		total += 1
	if total != 0:
		print(total, *r)
	else:
		print(total)
for i in range(int(input())):
	(n, m, k) = map(int, input().split())
	a = list(map(int, input().split()))
	quiz(a, n, m, k)


for _ in range(int(input())):
	(n, m, k) = map(int, input().split())
	l = list(map(int, input().split()))
	l.sort()
	r = []
	t = l[0]
	for i in range(1, k):
		if l[i] == t:
			if t <= n:
				r.append(t)
		else:
			t = l[i]
	print(len(set(r)), *set(r))


for i in range(int(input())):
	(N, M, K) = map(int, input().split())
	L = list(map(int, input().split()))
	L1 = dict()
	L2 = []
	count = 0
	for i in range(len(L)):
		if L[i] in L1.keys():
			L1[L[i]] += 1
		else:
			L1[L[i]] = 1
	for (key, value) in L1.items():
		if value > 1 and key <= N:
			L2.append(key)
			count += 1
	print(count, *sorted(L2))


from math import gcd, sqrt, ceil, floor, log
from heapq import heapify, heappop, heappush, nsmallest, nlargest
from collections import Counter, deque, OrderedDict, defaultdict
from itertools import combinations, permutations, zip_longest
from bisect import bisect_left, bisect_right
from functools import lru_cache, reduce
import sys
import time
import string
import operator
RECURSION_LIMIT = int(10000000.0)
INT_MAX = float('inf')
INT_MIN = float('-inf')
MOD = int(10000000.0) + 9
NEWLINE = '\n'
SPACE = ' '
sys.setrecursionlimit(RECURSION_LIMIT)
inp = lambda fn: fn(input())
inp_vars = lambda fn, delim, convert_to=list: convert_to(map(fn, input().split(delim)))
enum = lambda itr, start: enumerate(itr, start)

def toposort(graph, n):
	degree = [0] * n
	for node in graph:
		for adj in graph[node]:
			degree[adj] += 1
	bfs_queue = [node for node in range(n) if not degree[node]]
	for node in bfs_queue:
		for adj in graph[node]:
			degree[adj] -= 1
			if not degree[adj]:
				bfs_queue.append(adj)
	return (bfs_queue, degree)

def dfs(graph, node, visited):
	visited.add(node)
	for adj in graph[node]:
		if adj in visited:
			continue
		dfs(graph, adj, visited)

def seive(n):
	is_prime = [True] * (n + 1)
	is_prime[0] = is_prime[1] = False
	for i in range(2, int(n ** 0.5) + 1):
		if is_prime[i]:
			for j in range(i * i, n + 1, i):
				is_prime[j] = False
	return is_prime[n]

def bin_pow(x, y):
	if y == 0:
		return 1
	res = bin_pow(x, y >> 1)
	if y & 1 == 0:
		return res * res
	return x * res * res

def solve(*args, **kwargs):
	(n, m, k, arr) = args
	mp = Counter(arr)
	cheaters = sorted((key for (key, val) in mp.items() if val > 1 and 1 <= key <= n))
	res = [len(cheaters)]
	res.extend(cheaters)
	return res

def main(*args, **kwargs):
	for _ in range(int(input())):
		arg2 = inp_vars(int, SPACE)
		arg3 = inp_vars(int, SPACE)
		res = solve(*(*arg2, arg3))
		if type(res) in {list, tuple, set}:
			print(*res, sep=SPACE)
		else:
			print(res)
main()


from collections import Counter
testCases = int(input())
for testCase in range(testCases):
	(n, m, k) = map(int, input().split())
	l = list(map(int, input().split()))
	if n != 0:
		ans = []
		for i in Counter(l).most_common():
			if i[1] > 1 and i[0] <= n:
				ans.append(i[0])
		print(len(ans), *sorted(ans))
	else:
		print(0)


for _ in range(int(input())):
	(n, m, k) = map(int, input().split())
	L = list(map(int, input().split()))
	if k == 1:
		print(0)
		continue
	L.sort()
	li = [0] * (n + 1)
	count = 0
	for i in range(k):
		if L[i] > n:
			break
		li[L[i]] += 1
		if li[L[i]] == 2:
			count += 1
	mi = [i for i in range(n + 1) if li[i] > 1]
	print(count, *mi)


for _ in range(int(input())):
	(n, m, k) = map(int, input().split())
	arr = list(map(int, input().lstrip().split()))
	di = dict()
	li = []
	for i in range(len(arr)):
		if arr[i] in di:
			di[arr[i]] += 1
		else:
			di[arr[i]] = 1
	for j in di:
		if n + 1 <= j <= n + m:
			continue
		elif di[j] > 1:
			li.append(j)
	if len(li) == 0:
		print(0)
	else:
		li.sort()
		li.insert(0, len(li))
		print(*li, sep=' ')


for _ in range(int(input())):
	(n, m, k) = map(int, input().split())
	l = [int(x) for x in input().split()]
	x = n + m + 1
	f = [0] * x
	ans = set()
	for i in l:
		if i <= n:
			f[i] += 1
	for i in l:
		if f[i] > 1 and i not in ans:
			ans.add(i)
	print(len(ans), *ans)


from collections import Counter
for _ in range(int(input())):
	(n, m, k) = map(int, input().split())
	a = list(map(int, input().split()))
	q = []
	k = Counter(a)
	for i in k:
		if int(i) <= n and k[i] > 1:
			q.append(int(i))
	q.sort()
	print(len(q), *q)


for i in range(int(input())):
	(n, m, k) = map(int, input().split())
	l = list(map(int, input().split()))
	d = set()
	r = set()
	for j in l:
		if j <= n:
			if j in d:
				r.add(j)
			else:
				d.add(j)
	r = list(r)
	r.sort()
	print(len(r), *r)


from collections import Counter

def main():
	for _ in range(int(input())):
		(n, m, k) = map(int, input().split(' '))
		a = list(map(int, input().split(' ')))
		a.sort()
		a1 = Counter(a)
		a2 = []
		for i in a1.keys():
			if a1[i] > 1 and i <= n:
				a2.append(i)
		if len(a2) > 0:
			print(len(a2), *a2)
		else:
			print(0)
main()


n = int(input())
for x in range(n):
	q = input()
	m = int(q.split(' ')[0])
	n = int(q.split(' ')[1])
	r = int(q.split(' ')[2])
	dict1 = {}
	y = input()
	for x in y.split(' '):
		if x in dict1:
			dict1[x] = dict1[x] + 1
		else:
			dict1[x] = 1
	dict2 = {}
	for x in range(1, m + 1):
		m = str(x)
		if m in dict1 and dict1[m] > 1:
			dict2[x] = dict1[m]
	m = str(len(dict2)) + ' '
	for x in sorted(dict2):
		n = str(x)
		m = m + n + ' '
	print(m[:-1])


from collections import Counter
import math
import sys
for j in range(int(input())):
	(n, m, k) = map(int, input().split())
	kl = list(map(int, input().split()))
	l = Counter(kl)
	p = []
	for i in l:
		if int(i) <= n and l[i] > 1:
			p.append(int(i))
	p = sorted(p)
	print(len(p), *p)


T = int(input())
for _ in range(T):
	(n, m, k) = map(int, input().split())
	L = list(map(int, input().split()))
	d = {}
	for i in range(1, n + 1):
		d[i] = 0
	for i in range(k):
		a = L[i]
		if a <= n:
			d[a] += 1
	M = []
	ans = 0
	for i in range(1, n + 1):
		if d[i] > 1:
			ans += 1
			M.append(i)
	M.insert(0, ans)
	print(*M)


from collections import defaultdict
for _ in range(int(input())):
	(n, m, k) = (int(i) for i in input().split())
	a = [int(x) for x in input().split()]
	cnt = defaultdict(int)
	for i in a:
		if i <= n:
			cnt[i] += 1
	ans = []
	total = 0
	for i in cnt:
		if cnt[i] > 1:
			ans.append(i)
			total += 1
	print(total, *sorted(ans))


import sys
input = sys.stdin.readline

def rii():
	return range(int(input().strip()))

def ii():
	return int(input().strip())

def mii():
	return map(int, input().strip().split(' '))

def lmii():
	return list(map(int, input().strip().split(' ')))

def si():
	return str(input().strip())
from collections import defaultdict
from functools import reduce

def solve(*args):
	(n, m, k, l) = args
	attempts = defaultdict(int)
	admins = range(n + 1, n + m + 1)
	for x in l:
		if x in admins:
			continue
		attempts[x] += 1
	ans = [x for x in attempts if attempts[x] > 1]
	l_ans = len(ans)
	if len(ans) == 0:
		return f'{l_ans}'
	else:
		ans = reduce(lambda x, y: str(x) + ' ' + str(y), sorted(ans))
		return f'{l_ans} {ans}'

def do_codechef():
	for t in rii():
		(n, m, k) = mii()
		l = lmii()
		print(solve(n, m, k, l))
do_codechef()
exit()


from collections import Counter
T = int(input())
for tj in range(T):
	(n, m, k) = map(int, input().split())
	l = list(map(int, input().split()))
	l.sort()
	l1 = Counter(l)
	l2 = []
	for i in l1.keys():
		if l1[i] > 1 and i <= n:
			l2.append(i)
	if len(l2) > 0:
		print(len(l2), *l2)
	else:
		print(0)


t = int(input())
for i in range(t):
	(n, m, k) = map(int, input().split())
	l = list(map(int, input().split()))
	dic = {}
	for i in l:
		if i <= n:
			if i in dic:
				dic[i] += 1
			else:
				dic[i] = 1
	l = list(dic.keys())
	for i in l:
		if dic[i] == 1:
			del dic[i]
	if dic == {}:
		print(0)
		continue
	l = list(dic.keys())
	l.sort()
	l.insert(0, len(l))
	o = ''
	for i in l:
		o += str(i) + ' '
	o = o[:len(o) - 1]
	print(o)


t = int(input())
for z in range(t):
	(n, m, k) = map(int, input().split())
	a = list(map(int, input().split()))
	r = []
	l = [0 for i in range(0, n + 1)]
	for i in a:
		if i <= n:
			l[i] += 1
	for i in range(len(l)):
		if l[i] > 1:
			r.append(i)
	print(len(r), *r)


t = int(input())
for tc in range(t):
	(n, m, k) = map(int, input().split())
	arr = list(map(int, input().split()))
	d = set()
	res = set()
	for num in arr:
		if num <= n:
			if num in d:
				res.add(num)
			else:
				d.add(num)
	res = list(res)
	res.sort()
	print(len(res), *res)


t = int(input())
for i in range(t):
	(n, m, k) = map(int, input().split())
	l = list(map(int, input().split()))
	l.sort()
	c = 0
	a = []
	for j in range(k - 2):
		if l[j] == l[j + 1] and l[j + 1] != l[j + 2] and (l[j] <= n):
			c = c + 1
			a.append(l[j])
	if l[k - 1] == l[k - 2] and l[k - 1] <= n:
		c = c + 1
		a.append(l[k - 1])
	if k != 1:
		print(c, *a, sep=' ')
	else:
		print(0)


for u in range(int(input())):
	(n, m, k) = map(int, input().split())
	x = [int(w) for w in input().split()]
	candi = {i: 0 for i in range(1, n + 1)}
	for i in x:
		if 1 <= i <= n:
			candi[i] += 1
	ans = []
	for i in candi:
		if candi[i] > 1:
			ans.append(i)
	if len(ans):
		ans = [len(ans)] + ans
		print(*ans)
	else:
		print(0)


try:
	test = int(input())
	for i in range(test):
		disqual = []
		(n, m, k) = map(int, input().split())
		karr = list(map(int, input().split()))
		d = {}
		for x in karr:
			if x in d.keys():
				d[x] = d[x] + 1
			else:
				d[x] = 1
		for x in d:
			if d[x] > 1:
				if x <= n:
					disqual.append(x)
		disqual.sort()
		disqual.insert(0, len(disqual))
		print(*disqual, sep=' ')
except:
	pass


a = int(input())
for i in range(a):
	(n, m, k) = map(int, input().split())
	c = list(map(int, input().split()))
	p = 0
	t = 0
	f = 0
	e = []
	f = {}
	for i in c:
		if i in range(1, n + 1):
			if i in f:
				f[i] = f[i] + 1
			else:
				f[i] = 1
	for i in f:
		if f[i] > 1:
			e.append(i)
	e.sort()
	print(len(e), *e)


t = int(input())
for i in range(t):
	(a, b, c) = map(int, input().split())
	ans = []
	helper = {}
	arr = list(map(int, input().split()))
	for i in arr:
		if i <= a:
			if i in helper:
				helper[i] += 1
			else:
				helper[i] = 1
	for i in helper:
		if helper[i] > 1:
			ans.append(i)
	ans.sort()
	print(len(ans), *ans)


def merge_sort(data, left, right):
	if right - left < 1:
		return data[left:right + 1]
	else:
		mid = (left + right) // 2
		left = merge_sort(data, left, mid)
		right = merge_sort(data, mid + 1, right)
		return merge(left, right)

def merge(left, right):
	len_left = len(left)
	len_right = len(right)
	total_len = len_left + len_right
	new_data = []
	i = j = 0
	for index in range(total_len):
		if i == len_left:
			new_data.append(right[j])
			j += 1
		elif j == len_right:
			new_data.append(left[i])
			i += 1
		elif left[i] <= right[j]:
			new_data.append(left[i])
			i += 1
		elif left[i] > right[j]:
			new_data.append(right[j])
			j += 1
	return new_data
result = []
try:
	for testcase in range(int(input())):
		(n, m, k) = tuple(map(int, input().split()))
		data = list(map(int, input().split()))
		data.sort()
		count = {}
		answer = []
		for value in data:
			if value <= n:
				count[value] = count.get(value, 0) + 1
		for (key, value) in count.items():
			if value > 1:
				answer.append(key)
		answer.insert(0, len(answer))
		result.append(answer)
	for testcase in result:
		for (index, value) in enumerate(testcase):
			if index == len(testcase) - 1:
				print(value)
			else:
				print(value, end=' ')
except:
	pass