#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
const int maxn=1e6+7;
const int inf=2e9;
const ll inff=1e18;
const ll mod=1e9+7;
#define pii pair<int,int>
#define mkp make_pair
#define F first
#define S second
#define pb push_back
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(),(v).end()
//#define int ll

int dp[maxn][8];

int32_t main(){
	ios::sync_with_stdio(0); cin.tie(0);
	int n; cin>>n;
	string s,t; cin>>s>>t;
	
	dp[n][0]=1;
	int base=1;
	for (int i=n-1;i>=0;i--) {
		for (int j=0;j<7;j++) {
			int val=(t[i]=='T' ? 1 : 0);
			if (dp[i+1][j]==val||dp[i+1][(j+(s[i]-'0')*base)%7]==val) dp[i][j]=val;
			else dp[i][j]=(val^1);
		}
		base=base*10%7;
	}
	cout<<(dp[0][0] ? "Takahashi\n" : "Aoki\n");
}

#include <bits/stdc++.h>
#define fi first
#define se second
#define gc getchar() //(p1==p2&&(p2=(p1=buf)+fread(buf,1,size,stdin),p1==p2)?EOF:*p1++)
#define mk make_pair
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pb push_back
#define IT iterator
#define V vector
#define TP template <class o>
#define TPP template <typename t1, typename t2>
#define SZ(a) ((int)a.size())
#define all(a) a.begin(), a.end()
#define rep(i, a, b) for (int i = a; i <= b; i++)
#define REP(i, a, b) for (int i = b; i >= a; i--)
#define FOR(i, n) rep(i, 1, n)
#define debug(x) cerr << #x << ' ' << '=' << ' ' << x << endl
using namespace std;
typedef unsigned ui;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ld;

// char buf[1 << 20],*p1=buf,*p2=buf;
TP void qr(o& x) {
    char c = gc;
    x = 0;
    int f = 1;
    while (!isdigit(c)) {
        if (c == '-')
            f = -1;
        c = gc;
    }
    while (isdigit(c))
        x = x * 10 + c - '0', c = gc;
    x *= f;
}
template <class o, class... O> void qr(o& x, O&... y) {
    qr(x);
    qr(y...);
}
TP void qw(o x) {
    if (x / 10)
        qw(x / 10);
    putchar(x % 10 + '0');
}
TP void pr1(o x) {
    if (x < 0)
        x = -x, putchar('-');
    qw(x);
    putchar(' ');
}
template <class o, class... O> void pr1(o x, O... y) {
    pr1(x);
    pr1(y...);
}
TP void pr2(o x) {
    if (x < 0)
        x = -x, putchar('-');
    qw(x);
    putchar(10);
}
template <class o, class... O> void pr2(o x, O... y) {
    pr2(x);
    pr2(y...);
}

TP void cmax(o& x, o y) {
    if (x < y)
        x = y;
}
TP void cmin(o& x, o y) {
    if (x > y)
        x = y;
}

const int mod = 998244353;
TPP void ad(t1& x, t2 y) {
    x += y;
    if (x >= mod)
        x -= mod;
}
TPP void dl(t1& x, t2 y) {
    x -= y;
    if (x < 0)
        x += mod;
}

const int N = 2e5 + 10, inf = 2e9;
const ll INF = 1e15;
int n, k, d[N], now, ans;
V<int> e[N];
void ins(int x, int y) { e[x].pb(y); }

void dfs(int x, int fa) {
    int mn = N, mx = 0; //* d[x] >= 0 表示子树内有一个距离x d[x]的点. d[x] < 0 表示子树外有一个距离x -d[x]的点.
    for (int y : e[x])
        if (y ^ fa)
            dfs(y, x), cmin(mn, d[y] + 1), cmax(mx, d[y] + 1);
    d[x] = mn + mx < 0 ? mn : mx; //能覆盖就忽略mx. 否则保留mx.
    if (d[x] >= now)
        d[x] = -now - 1, ans++;
}

bool check() {
    dfs(1, 0);
    ans += (d[1] >= 0);
    return ans <= k;
}

void solve() {
    qr(n, k);
    FOR(i, n - 1) {
        int x, y;
        qr(x, y);
        ins(x, y);
        ins(y, x);
    }
    int l = 1, r = n, mid;
    while (l < r) {
        mid = (l + r) / 2;
        ans = 0;
        now = mid;
        if (check())
            r = mid;
        else
            l = mid + 1;
        debug(mid);
        debug(ans);
    }
    pr2(l);
}

int main() {
#ifndef ONLINE_JUDGE
    clock_t start_time = clock();
#endif
    int T = 1;
    // qr(T);
    while (T--)
        solve();
#ifndef ONLINE_JUDGE
    cerr << 1.0 * (clock() - start_time) / CLOCKS_PER_SEC << ' ' << 's' << endl;
#endif
    return 0;
}