#include<bits/stdc++.h>
using namespace std;
#define ll long long

#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")

#define speed                       ios_base::sync_with_stdio(0); cin.tie(0);
#define FL(i,a,n)                   for(ll i=a;i<n;i++)
#define even(x)                     (((x)%(2)) == (0))
#define odd(x)                      (((x)%(2)) == (1))
#define meme(x)                     memset(x, 0, sizeof(x))
#define mod                         1000000007
#define onebit(x)                   __builtin_popcountll(x)
#define endl                        "\n"

#define pb                          push_back
#define mp                          make_pair
#define ff                          first
#define ss                          second
#define all(x)                      (x).begin(),(x).end()

typedef long double                 ld;
typedef pair<int,int>               pii;
typedef pair<ll,ll>                 pll;
typedef pair<double,double>         pdd;
typedef pair<ld,ld>                 pld;
typedef pair<string , string>       pss;


int main() 
{
	int t;
    t=1;
    //cin>>t;
	while(t--)
    {
        ll a,b,k;
        cin>>a>>b>>k;

        while(a>0 && b>0)
        {
            a--;
            b--;
        }


        if(a==0 && b!=0)
        cout<<"Aoki"<<endl;
        else if(b==0 && a!=0)
        cout<<"Takahashi"<<endl;
        else
        {
            if(a==0 && b==0)
            {
                if(k==1)
                cout<<"Takahashi"<<endl;
                else
                {
                    cout<<"Aoki"<<endl;
                }
                
            }   
        }
        


		
	}
	return 0;
}
#include<bits/stdc++.h>
using namespace std;
void __print(int x){cout<<x;}void __print(long x){cout<<x;}
void __print(long long x){cout<<x;}void __print(unsigned x){cout<<x;}
void __print(unsigned long x){cout<<x;}void __print(unsigned long long x){cout<<x;}
void __print(float x){cout<<x;}void __print(double x){cout<<x;}
void __print(long double x){cout<<x;}void __print(char x){cout<<'\''<<x<<'\'';}
void __print(const char *x){cout<<'\"'<<x<<'\"';}void __print(const string &x){cout<<'\"'<<x<<'\"';}
void __print(bool x) {cout<<(x?"true":"false");}
template<typename T, typename V>
void __print(const pair<T, V> &x) {cout << '{'; __print(x.first); cout << ','; __print(x.second); cout << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cout << '{'; for (auto &i: x) cout << (f++ ? "," : ""), __print(i); cout << "}";}
void _print() {cout << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cout << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cout << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
           
#define lp(i,a,b)       for (ll i=a;i<=b;i++)
#define rp(i,a,b)       for (ll i=a;i>=b;i--)
#define ms(a,x)         memset(a,x,sizeof a)
#define ll              long long 
#define ff              first
#define ss              second
#define all(a)          a.begin(),a.end()
#define rall(a)         a.rbegin(),a.rend()
#define pb              push_back
#define nl              cout<<"\n"
#define gcd(a,b)        __gcd((a),(b))
#define lcm(a,b)        ((a)*(b))/(gcd(a,b))
#define sq(a)           ((a)*(a)*(a))
#define sz(a)           (int) a.size()
#define mod             1000000007
#define PI              (2*acos(0.0))
const ll N=2e5+5;
vector<array<ll,2>> g[N];
ll A[N];
void dfs(ll node,ll p,ll x)
{
  A[node]=x;
  for(auto [adj,cost]:g[node])
  {
    if(adj!=p) dfs(adj,node,x^cost);
  }
}
void solve() 
{
  ll n;
  cin>>n;
  lp(i,1,n-1)
  {
    ll a,b,c;
    cin>>a>>b>>c;
    g[a].pb({b,c});
    g[b].pb({a,c});
  }
  dfs(1,-1,0);
  ll res=0;
  lp(i,0,60)
  {
    ll one=0,zero=0;
    lp(j,1,n)
    {
          if(A[j] & 1ll<<i) one++;
          else zero++;
    }
    res=((res)+(1ll<<i)%mod*one%mod*zero%mod)%mod;
  }
  cout<<res;
}

int main()
{
  ios_base::sync_with_stdio(false); 
  cin.tie(NULL); cout.tie(NULL);
  int T=1;
  //cin>>T;
  while(T--) solve();
}
