#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define ll long long
#define ld long double
#define ull unsigned long long
void dbg_out() { cout << endl; }
template<typename Head, typename... Tail> void dbg_out(Head H, Tail... T) { cout << ' ' << H; dbg_out(T...); }
#define dbg(...) cout << "(" << #__VA_ARGS__ << "):", dbg_out(__VA_ARGS__)
void solve()
{
  vector<ll> one(18), two(18);
  for(auto &el : one) cin >> el;
  for(auto &el : two) cin >> el;
  ll suma1=0, suma2=0;
  map<ll, ll> mp1,mp2;
  for(ll i = 0; i <= 10; i++){
    mp1[i]=0;
    mp2[i]=0;
  }
  for(auto el : one){
    suma1+=el;
    mp1[el]++;
  }
  for(auto el : two){
    suma2+=el;
    mp2[el]++;
  }
  if(suma1 > suma2){
    cout << "Algosia\n";
  } else if(suma1 < suma2){
    cout << "Bajtek\n";
  } else{
    for(ll i = 10; i >= 0; i--){
      if(mp1[i] > mp2[i]){
        cout << "Algosia\n";
        return;
      }
      if(mp1[i] < mp2[i]){
        cout << "Bajtek\n";
        return;
      }
    }
  }
  cout << "dziala\n";
}
 
int main()
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
// #ifndef ONLINE_JUDGE
//   freopen("../../in.in", "r", stdin);
//   freopen("../../out.out", "w", stdout);
// #endif
  
  solve();
  
}
        1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64  | #include <bits/stdc++.h> using namespace std; #define endl "\n" #define ll long long #define ld long double #define ull unsigned long long void dbg_out() { cout << endl; } template<typename Head, typename... Tail> void dbg_out(Head H, Tail... T) { cout << ' ' << H; dbg_out(T...); } #define dbg(...) cout << "(" << #__VA_ARGS__ << "):", dbg_out(__VA_ARGS__) void solve() { vector<ll> one(18), two(18); for(auto &el : one) cin >> el; for(auto &el : two) cin >> el; ll suma1=0, suma2=0; map<ll, ll> mp1,mp2; for(ll i = 0; i <= 10; i++){ mp1[i]=0; mp2[i]=0; } for(auto el : one){ suma1+=el; mp1[el]++; } for(auto el : two){ suma2+=el; mp2[el]++; } if(suma1 > suma2){ cout << "Algosia\n"; } else if(suma1 < suma2){ cout << "Bajtek\n"; } else{ for(ll i = 10; i >= 0; i--){ if(mp1[i] > mp2[i]){ cout << "Algosia\n"; return; } if(mp1[i] < mp2[i]){ cout << "Bajtek\n"; return; } } } cout << "dziala\n"; } int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); // #ifndef ONLINE_JUDGE // freopen("../../in.in", "r", stdin); // freopen("../../out.out", "w", stdout); // #endif solve(); }  | 
            
        
                    English