using System; using System.Linq; class A { static int[] Read() => Array.ConvertAll(Console.ReadLine().Split(), int.Parse); static void Main() => Console.WriteLine(string.Join("\n", new int[int.Parse(Console.ReadLine())].Select(_ => Solve() ? "Yes" : "No"))); static bool Solve() { var a1 = Read(); var a2 = Read(); var x = "AWTMOR".IndexOf(Console.ReadLine()[0]); return a1[x] == 0 && a2.Where((v, i) => i != 0 && i != x).Sum() == 0 && a1.Skip(1).Sum() <= a2[x]; } }