Problem: Example

Input

3 5 4
3
6
12


Output

Hanako

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcountll

#define INF 1e16
#define mod 1000000007

ll N,A,B;
ll S[100010];

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);

  cin>>N>>A>>B;
  rep(i,N)cin>>S[i];
  if(A==B){
    ll g=0;
    rep(i,N)g^=(S[i]%(A+1));
    if(g==0)cout<<"Jiro"<<endl;
    else cout<<"Hanako"<<endl;
    return 0;
  }
  if(A>B){
    bool done=false;
    rep(i,N)if(S[i]>B)done=true;
    if(done){
      cout<<"Hanako"<<endl;
    }else{
      ll g=0;
      rep(i,N)g^=S[i];
      if(g==0)cout<<"Jiro"<<endl;
      else cout<<"Hanako"<<endl;
    }
  }else{
    ll idx=-1;
    rep(i,N)if(S[i]>A){
      if(idx!=-1){
        cout<<"Jiro"<<endl;
        return 0;
      }
      idx=i;
    }
    if(idx==-1){
      ll g=0;
      rep(i,N)g^=S[i];
      if(g==0)cout<<"Jiro"<<endl;
      else cout<<"Hanako"<<endl;
    }else{
      ll g=0;
      rep(i,N)if(i!=idx)g^=S[i];
      if(S[idx]>g&&S[idx]-g<=A&&g<=A)cout<<"Hanako"<<endl;
      else cout<<"Jiro"<<endl;
    }
  }

  return 0;
}