from sys import stdin

def getInt():
	return int(stdin.readline())
	
def getInts():
	return tuple(int(_) for _ in stdin.readline().split())

numCases = getInt()
for caseIndex in xrange(1, 1 + numCases):
	(numStudents, numChocolates) = getInts()
	chocolateAmounts = [0] * numStudents
	for chocolateIndex in xrange(numChocolates):
		(fromStudent, toStudent, chocolateGift) = getInts()
		for studentIndex in xrange(fromStudent, toStudent+1):
			chocolateAmounts[studentIndex] += chocolateGift
	numFriends = getInt()
	for friendIndex in xrange(numFriends):
		friendPosition = getInt()
		print chocolateAmounts[friendPosition]