#include #include #include #include #include #include using namespace std; //sg[i] - Sprague-Grundy's number for a group of i stones. We can calculate it in a //standard way because there are only 6 numbers that n^n does not exceed 10^5. int main(){ int tc; scanf("%d", &tc); int sg[100333]; sg[0] = 0; int deg[123]; int i, j; for (i = 1; i <= 7; i++){ deg[i] = 1; for (j = 1; j <= i; j++) deg[i] = deg[i] * i; } int o = 0; int used[1000]={}; for (i = 1; i <= 100000; i++){ o++; for (j = 1; deg[j] <= i; j++){ used[sg[i- deg[j]]] = o;//mark all reachble positions with 'o' } for (j = 0; j <= 1 << 30; j++) if (used[j] != o) {sg[i] = j; break;}//finding MEX } while (tc--){ int n; scanf("%d", &n); int ans = 0; for (i = 1; i <= n; i++){ int x; scanf("%d", &x); ans ^= sg[x]; } if (ans) printf("Little Chef\n"); else printf("Head Chef\n"); } }