#!/usr/bin/env python3 # NOTE: it is recommended to use this even if you don't understand the following code. # input data N = int(input().strip()) S = [(list(map(int, input().strip().split()))[1:]) for _ in range(N)] T = [(list(map(int, input().strip().split()))[1:]) for _ in range(N)] Q = int(input().strip()) U = [0 for _ in range(Q)] V = [0 for _ in range(Q)] for i in range(Q): U[i], V[i] = map(int, input().strip().split()) # print the results for i in range(Q): print("YES")