Problem: Example

Input

3 5 4
3
6
12


Output

Hanako

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
const int maxn=112345;
int n,a,b,s[maxn],sg,big,id;
int main()
{
    scanf("%d%d%d",&n,&a,&b);
    for (int i=0;i<n;++i) {
        scanf("%d",&s[i]);
        sg^=s[i]%(min(a,b)+1);
        if (s[i]>min(a,b)) ++big,id=i;
    }
    if (a==b) puts(sg?"Hanako":"Jiro");
    else if (a>b) puts((sg||big)?"Hanako":"Jiro");
    else {
        if (!sg||big>1) puts("Jiro");
        else if (big==1) {
            int x=sg^(s[id]%(a+1));
            if (x<=a&&s[id]-x<=a) puts("Hanako");
            else puts("Jiro");
        } else puts("Hanako");
    }
    return 0;
}