The gardener Kazimir Kazimirovich has an array of $n$ integers $c_1, c_2, \dots, c_n$.

He wants to check if there are two different subsequences $a$ and $b$ of the original array, for which $f(a) = f(b)$, where $f(x)$ is the bitwise OR of all of the numbers in the sequence $x$.

A sequence $q$ is a subsequence of $p$ if $q$ can be obtained from $p$ by deleting several (possibly none or all) elements.

Two subsequences are considered different if the sets of indexes of their elements in the original sequence are different, that is, the values of the elements are not considered when comparing the subsequences.


-----Input-----

Each test contains multiple test cases. The first line contains the number of test cases $t$ ($1 \le t \le 10^5$). The description of the test cases follows.

The first line of each test case contains one integer $n$ ($1 \le n \le 10^5$) — the size of the array $c$.

The description of the array $c$ in this problem is given implicitly to speed up input.

The $(i + 1)$-st of the following $n$ lines of the test case begins with an integer $k_i$ ($1 \le k_i \le 10^5$) — the number of set bits in the number $c_i$. Next follow $k_i$ distinct integers $p_{i, 1}, p_{i, 2}, \dots, p_{i, k_i}$ ($1 \le p_i \le 2 \cdot 10^5$) —the numbers of bits that are set to one in number $c_i$. In other words, $c_i = 2^{p_{i, 1}} + 2^{p_{i, 2}} + \ldots + 2^{p_{i, k_i}}$.

It is guaranteed that the total sum of $k_i$ in all tests does not exceed $10^5$.


-----Output-----

For each set of input, print "Yes" if there exist two different subsequences for which $f(a) = f(b)$, and "No" otherwise.

You can output the answer in any case (upper or lower). For example, the strings "yEs", "yes", "Yes", and "YES" will be recognized as positive responses.


-----Examples-----

Input
5
3
2 1 5
2 2 4
2 2 3
2
2 1 2
1 2
4
3 1 2 4
2 2 4
4 1 2 5 6
2 2 5
5
3 3 1 2
3 2 5 3
5 7 2 3 1 4
5 1 2 6 3 5
3 2 6 3
2
1 1
1 2
Output
No
Yes
Yes
Yes
No


-----Note-----

It can be proven that in the first test case there are no two different subsequences $a$ and $b$ for which $f(a) = f(b)$.

In the second test case, one of the possible answers are following subsequences: the subsequence $a$ formed by the element at position $1$, and the subsequence $b$ formed by the elements at positions $1$ and $2$.

In the third test case, one of the possible answers are following subsequences: the subsequence $a$ formed by elements at positions $1$, $2$, $3$ and $4$, and the subsequence $b$ formed by elements at positions $2$, $3$ and $4$.

Difficulty: EASY

Solutions:
import sys
input = sys.stdin.readline
for _ in range(int(input())):
	n = int(input())
	Cnt = {}
	K = []
	for __ in range(n):
		K.append(list(map(int, input().split()))[1:])
		for c in K[-1]:
			if c in Cnt:
				Cnt[c] += 1
			else:
				Cnt[c] = 1
	flag = 0
	for k in K:
		for c in k:
			if Cnt[c] == 1:
				flag += 1
				break
	if flag == n:
		print('No')
	else:
		print('Yes')


import sys
from collections import defaultdict
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	n = int(input())
	check = defaultdict(int)
	ps = []
	for i in range(n):
		(k, *p) = map(int, input().split())
		ps += [p]
	for p in ps:
		for e in p:
			check[e] += 1
	for p in ps:
		all2 = True
		for e in p:
			all2 &= check[e] >= 2
		if all2:
			print('Yes')
			break
	else:
		print('No')


from itertools import chain

def read_bits():
	return list(set(list(map(int, input().split(' ')))[1:]))

def read_test():
	test_size = int(input())
	nums = []
	for _ in range(test_size):
		nums.append(read_bits())
	return nums

def read_input():
	test_num = int(input())
	tests = []
	for _ in range(test_num):
		tests.append(read_test())
	return tests

def solve(test):
	bit_counts = {}
	for num in test:
		for bit in num:
			if bit not in bit_counts:
				bit_counts[bit] = 1
			else:
				bit_counts[bit] = bit_counts[bit] + 1
	for num in test:
		has_unique = False
		for bit in num:
			if bit_counts[bit] == 1:
				has_unique = True
		if not has_unique:
			return 'Yes'
	return 'No'

def main():
	tests = read_input()
	for test in tests:
		print(solve(test))
main()


t = int(input())
res = []
for _ in range(t):
	n = int(input())
	freq = {}
	store = []
	for i in range(n):
		a = list(map(int, input().split()[1:]))
		store.append(a)
		for i in a:
			if i not in freq:
				freq[i] = 0
			freq[i] += 1
	ans_p = 'No'
	for i in range(n):
		k = len(store[i])
		ans = True
		for j in range(k):
			if freq[store[i][j]] == 1:
				ans = False
				break
		if ans == True:
			ans_p = 'Yes'
			break
	res.append(ans_p)
for i in res:
	print(i)


for _ in range(int(input())):
	dic = {}
	n = int(input())
	lis = []
	for i in range(n):
		l = [int(i) for i in input().split()]
		lis.append(l[1:])
		for j in l[1:]:
			if dic.get(j) == None:
				dic[j] = 1
			else:
				dic[j] += 1
	ok = False
	for i in lis:
		fl = 1
		for j in i:
			if dic[j] == 1:
				fl = 0
				break
		if fl == 1:
			ok = True
	print('Yes') if ok else print('No')


t = int(input())
for _ in range(t):
	n = int(input())
	arr = []
	d = {}
	for _ in range(n):
		k = list(map(int, input().split()))
		del k[0]
		arr.append(k)
		for i in k:
			if i in d:
				d[i] += 1
			else:
				d[i] = 1
	for i in arr:
		ans = True
		for j in i:
			if d[j] <= 1:
				ans = False
		if ans:
			print('Yes')
			break
	if not ans:
		print('No')


from collections import defaultdict

def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		counts = defaultdict(lambda : 0)
		vv = list()
		for i in range(n):
			k_list = list(map(int, input().split(' ')[1:]))
			vv.append(k_list)
			for k in k_list:
				counts[k] += 1
		for v in vv:
			all = True
			for i in v:
				if counts[i] == 1:
					all = False
			if all:
				print('Yes')
				break
		if not all:
			print('No')
main()


for _ in range(int(input())):
	n = int(input())
	f = []
	new = []
	for i in range(n):
		a = list(map(int, input().split()))
		if len(a) >= 2:
			for j in range(1, len(a)):
				new.append([a[j], i + 1])
		else:
			new.append([a[-1], i + 1])
	new.sort()
	if n == 1:
		print('No')
	else:
		for i in range(1, len(new) - 1):
			if new[i][0] != new[i + 1][0] and new[i][0] != new[i - 1][0]:
				f.append(new[i][1])
		if new[0][0] != new[1][0]:
			f.append(new[0][1])
		if new[-1][0] != new[-2][0]:
			f.append(new[-1][1])
		f = list(set(f))
		ans = 0
		for i in range(len(f)):
			if f[i] == i + 1:
				ans += 1
		if ans == n:
			print('No')
		else:
			print('Yes')


for _ in range(int(input())):
	n = int(input())
	v = []
	dic = {}
	for i in range(n):
		v.append(list(input().split())[1:])
	for i in v:
		for j in i:
			if j not in dic:
				dic[j] = 0
			dic[j] += 1
	flag = True
	for i in v:
		m = float('+inf')
		for j in i:
			m = min(m, dic[j])
		if m > 1:
			flag = False
			break
	if flag:
		print('No')
	else:
		print('Yes')


for _ in ' ' * int(input()):
	e = {}
	d = int(input())
	c = [[] for _ in ' ' * d]
	for i in range(d):
		for b in map(int, input().split()[1:]):
			c[i].append(b)
			e[b] = e.get(b, 0) + 1
	for j in range(d):
		f = False
		for a in c[j]:
			if e[a] == 1:
				f = True
				break
		if not f:
			print('Yes')
			break
	else:
		print('No')


t = int(input())
for _ in range(t):
	n = int(input())
	nums = []
	cnt = {}
	for _ in range(n):
		line = input().strip().split()
		nums.append([int(v) for v in line[1:]])
		for v in nums[-1]:
			cnt[v] = cnt.get(v, 0) + 1
	yes = False
	for cand in nums:
		if all((cnt[v] > 1 for v in cand)):
			yes = True
			break
	print('Yes' if yes else 'No')


def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())
tests = inp()
for i in range(tests):
	length = inp()
	arr = []
	freq_hashmap = {}
	for _ in range(length):
		temp = inlt()[1:]
		arr.append(temp)
		for j in temp:
			if j in freq_hashmap:
				freq_hashmap[j] += 1
			else:
				freq_hashmap[j] = 1
	ans = 'No'
	for element in arr:
		min_freq = 10 ** 9
		for bit in element:
			min_freq = min(min_freq, freq_hashmap[bit])
		if min_freq > 1:
			ans = 'Yes'
			break
	print(ans)


t = int(input())
for _ in range(t):
	(bitsdict, bitslist) = ({}, [])
	k = int(input())
	for _ in range(k):
		bitset = [int(x) for x in input().split(' ')][1:]
		bitslist.append(bitset)
		for bit in bitset:
			if bitsdict.get(bit, False):
				bitsdict[bit] += 1
			else:
				bitsdict[bit] = 1
	flag = False
	for bitset in bitslist:
		if any((bitsdict[bit] == 1 for bit in bitset)):
			continue
		else:
			flag = True
			break
	if flag:
		print('Yes')
	else:
		print('No')


from collections import defaultdict
t = int(input())
for i in range(t):
	n = int(input())
	c = []
	for i in range(n):
		p = list(map(int, input().split()))
		c.append(p[1:])
	dic = defaultdict(int)
	for li in c:
		for val in li:
			dic[val] = dic[val] + 1
	cnt = 0
	for li in c:
		fnd = 0
		for val in li:
			if dic[val] == 1:
				cnt = cnt + 1
				fnd = 1
				break
	if cnt == len(c):
		print('No')
	else:
		print('Yes')


from collections import defaultdict
T = int(input())
D = defaultdict(int)
for t in range(T):
	N = int(input())
	A = [list(map(int, input().split())) for _ in range(N)]
	for a in A:
		for k in a[1:]:
			D[k] += 1
	ok = False
	for a in A:
		flag = True
		for k in a[1:]:
			if D[k] < 2:
				flag = False
				break
		if flag:
			ok = True
			break
	if ok:
		print('Yes')
	else:
		print('No')
	D.clear()


def solution() -> None:
	n = int(input())
	arr = [[] for _ in range(n)]
	count = {}
	for i in range(n):
		arr[i] = list(map(int, input().split()[1:]))
		for j in range(len(arr[i])):
			count[arr[i][j]] = count.get(arr[i][j], 0) + 1
	for i in range(n):
		for j in range(len(arr[i])):
			if count[arr[i][j]] == 1:
				break
		else:
			print('Yes')
			return
	print('No')
for _ in range(int(input())):
	solution()


from collections import defaultdict
tests = int(input())
for test in range(tests):
	arr_len = int(input())
	all_cnt = defaultdict(lambda : 0)
	all_set = set()
	for i in range(arr_len):
		a = list(map(int, input().split()))
		b = a[1:]
		for j in b:
			if all_cnt[j] == 0:
				all_cnt[j] = (1, i + 1)
			else:
				all_cnt[j] = 2
	for i in all_cnt.values():
		if i != 2:
			all_set.add(i)
	if len(all_set) == arr_len:
		print('No')
	else:
		print('Yes')


def makichut():
	for i in range(len(l)):
		for j in range(len(l[i])):
			if d[l[i][j]] < 2:
				break
		else:
			return 'Yes'
	return 'No'
for i in range(int(input())):
	n = int(input())
	l = []
	for i in range(n):
		a = list(map(int, input().split()))
		l.append(a[1:])
	d = {}
	for i in range(len(l)):
		for j in range(len(l[i])):
			d[l[i][j]] = 0
	for i in range(len(l)):
		for j in range(len(l[i])):
			d[l[i][j]] += 1
	print(makichut())


from collections import defaultdict
for _ in range(int(input())):
	n = int(input())
	ll = []
	a = defaultdict(lambda : [0 for i in range(2)])
	for i in range(n):
		ll.append(list(map(int, input().split()))[1:])
		for j in range(len(ll[i])):
			a[ll[i][j]][0] += 1
			if a[ll[i][j]][0] == 1:
				a[ll[i][j]][1] = i
	s = set()
	for item in a:
		if a[item][0] == 1:
			s.add(a[item][1])
	if len(s) == n:
		print('No')
	else:
		print('Yes')


from collections import *
T = lambda : [*map(int, input().split())]
for _ in [0] * T()[0]:
	b = []
	d = Counter()
	for _ in [0] * T()[0]:
		b += (T()[1:],)
		d.update(b[-1])
	print('YNeos'[all((any((d[y] < 2 for y in z)) for z in b))::2])


from collections import *
R = lambda : [*map(int, input().split())]
for _ in [0] * R()[0]:
	a = []
	c = Counter()
	for _ in [0] * R()[0]:
		a += (R()[1:],)
		c.update(a[-1])
	print('YNeos'[all((any((c[x] < 2 for x in y)) for y in a))::2])


from collections import Counter

def solve():
	n = int(input())
	c = [list(map(int, input().split())) for i in range(n)]
	c = [x[1:] for x in c]
	cnt = Counter([i for sub in c for i in sub])
	for i in range(n):
		ok = 1
		for x in c[i]:
			if cnt[x] == 1:
				ok = 0
				break
		if ok:
			return 'Yes'
	return 'No'
t = int(input())
for _ in range(t):
	print(solve())


from collections import *
f_gcK = lambda : [*map(int, input().split())]
for _ in [0] * f_gcK()[0]:
	f_H_gd = []
	j_kDf = Counter()
	for _ in [0] * f_gcK()[0]:
		f_H_gd += (f_gcK()[1:],)
		j_kDf.update(f_H_gd[-1])
	print('YNeos'[all((any((j_kDf[x] < 2 for x in y)) for y in f_H_gd))::2])


import itertools
from collections import Counter

def solve(sets):
	all_ctr = Counter(itertools.chain(*sets))
	for set in sets:
		ctr = Counter(set)
		if all((ctr[v] < all_ctr[v] for v in ctr.keys())):
			return True
	return False

def run():
	n = int(input())
	sets = []
	for _ in range(n):
		sets.append([int(x) for x in input().split()][1:])
	ans = solve(sets)
	if ans:
		print('Yes')
	else:
		print('No')
tests_nr = int(input())
for _ in range(tests_nr):
	run()