This is my code:
t = int(input())
for _ in range(t):
tr = input()
tr_s = list(map(int, input().strip().split()))
dr = input()
dr_s = list(map(int, input().strip().split()))
ts = input()
ts_s = list(map(int, input().strip().split()))
ds = input()
ds_s = list(map(int, input().strip().split()))
tr_s = set(tr_s)
dr_s = set(dr_s)
ts_s = set(ts_s)
ds_s = set(ds_s)
if ts_s.issubset(tr_s) and ds_s.issubset(dr_s):
print('yes')
else:
print('no')