Problem: Example

Input

3 5 4
3
6
12


Output

Hanako

Solution (in CPP):

Solution:
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

//INSERT ABOVE HERE
signed main(){
  Int n,a,b;
  cin>>n>>a>>b;
  vector<Int> s(n);
  for(Int i=0;i<n;i++) cin>>s[i];

  if(a==b){
    Int res=0;
    for(Int i=0;i<n;i++)
      res^=s[i]%(a+1);
    
    cout<<(res?"Hanako":"Jiro")<<endl;
    return 0;
  }
  if(a<b){    
    Int res=0,flg=0;
    for(Int i=0;i<n;i++){
      res^=s[i]%(a+1);
      flg+=s[i]>a;
    }
    if(!flg){
      cout<<(res?"Hanako":"Jiro")<<endl;
      return 0;
    }
    if(flg>=2){
      cout<<"Jiro"<<endl;
      return 0;
    }
    for(Int i=0;i<n;i++){
      if(s[i]<=a) continue;
      res^=s[i]%(a+1);
      if(res<=a&&res<s[i]&&(s[i]-res)<=a){
        cout<<"Hanako"<<endl;
        return 0;
      }
    }
    cout<<"Jiro"<<endl;
    return 0;
  }
  if(a>b){    
    Int res=0,flg=0;
    for(Int i=0;i<n;i++){
      res^=s[i]%(b+1);
      flg+=s[i]>b;
    }
    if(flg){
      cout<<"Hanako"<<endl;
      return 0;
    }
    cout<<(res?"Hanako":"Jiro")<<endl;    
    return 0;
  }
  return 0;
}