using System; using static System.Console; using System.Linq; using System.Collections.Generic; class Program { static int NN => int.Parse(ReadLine()); static long[] NList => ReadLine().Split().Select(long.Parse).ToArray(); // static int[][] NArr(long n) => Enumerable.Repeat(0, (int)n).Select(_ => NList).ToArray(); public static void Main() { Solve(); } static void Solve() { var t = NN; var ans = new char[t]; for (var u = 0; u < t; ++u) { var c = NList; var (k, x, y) = (c[0], c[1], c[2]); var a = NList; var p = NList; var g = 0L; for (var i = 0; i < k; ++i) g ^= a[i] % (p[i] + 1); if (y - g >= x) ans[u] = 'C'; else ans[u] = 'Z'; } WriteLine(string.Join("\n", ans)); } }