t = int(input()) for _ in range(t): n, m = map(int, input().split()) a = [0 for i in range(n)] otr = [] for i in range(m): x, y = map(int, input().split()) x -= 1 y -= 1 otr.append((x, y)) k = int(input()) f1 = 0 for i in range(k): zap = int(input()) if f1: continue zap -= 1 a[zap] = 1 f = 0 for e in otr: if sum(a[e[0]:e[1] + 1]) > (e[1] - e[0] + 1) / 2: f += 1 if f > 0: print(i + 1) f1 = 1 if f1 == 0: print(-1)