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

int main() {
  int A, B, C;
  cin >> A >> B >> C;
  pair<int, int> p = {A, B};
  string ans;
  string next = C == 0 ? "A" : "B";

  while (true) {
    if (next == "A") {
      if (p.first < 0) {
        ans = "Aoki";
        break;
      }
      p.first--;
      next = "B";
    } else {
      if (p.second < 0) {
        ans = "Takahashi";
        break;
      }
      p.second--;
      next = "A";
    }
  }
  cout << ans << endl;
}
#pragma GCC optimize("O3")
#pragma GCC optimize ("unroll-loops")
#define io_init cin.tie(0);ios::sync_with_stdio(0);cout<<fixed<<setprecision(20)
#include <bits/stdc++.h>
constexpr int INF = 2147483647;
constexpr long long int INF_LL = 9223372036854775807;
constexpr int MOD = 1000000007;
constexpr double PI = 3.14159265358979323846;
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;

int main() {
	string S[3];
	cin >> S[0] >> S[1] >> S[2];
	set<char> st;
	for (int i = 0; i < 3; i++) {
		for (int j = 0; j < S[i].size(); j++)st.insert(S[i][j]);
	}
	if (st.size() > 10) {
		cout << "UNSOLVABLE" << endl;
		return 0;
	}
	
	map<char, int> mp;
	int tmp = 0;
	for (auto&& x : st) {
		mp[x] = tmp;
		tmp++;
	}

	vector<int> a = { 0,1,2,3,4,5,6,7,8,9 };
	do {
		if (a[mp[S[0][0]]] == 0 || a[mp[S[1][0]]] == 0 || a[mp[S[2][0]]] == 0)continue;
		string N[3];
		for (int i = 0; i < 3; i++) {
			N[i] = S[i];
			for (int j = 0; j < N[i].size(); j++) {
				N[i][j] = a[mp[N[i][j]]] + '0';
			}
		}
		ll n[3];
		for (int i = 0; i < 3; i++)n[i] = stoll(N[i]);
		if (n[0] + n[1] == n[2]) {
			cout << N[0] << endl << N[1] << endl << N[2] << endl;
			return 0;
		}

	} while (next_permutation(a.begin(), a.end()));

	cout << "UNSOLVABLE" << endl;
}