convert = {'WA': 1, 'TLE': 2, 'MLE': 3, 'OLE': 4, 'RE': 5} for _ in range(int(input())): A = list(map(int, input().split())) B = list(map(int, input().split())) s = input() idx = convert[s] if sum(A) - A[0] <= B[idx]: print("Yes") else: print("No")