#include <iostream>
#include <string>
#include <vector>

int main() {
  int N;
  std::string S, X;
  std::cin >> N >> S >> X;
  std::vector<bool> state(7);
  state[0] = true;
  for (int i = N - 1; i >= 0; --i) {
    const std::vector<int> digits = {S[i] - '0', 0};
    std::vector<bool> next(7);
    state.swap(next);
    for (int j = 0; j < 7; ++j) {
      state[j] = X[i] == 'A';
      for (const int digit : digits) {
        if (next[(10 * j + digit) % 7] ^ state[j]) {
          state[j] = !state[j];
          break;
        }
      }
    }
  }
  std::cout << (state[0] ? "Takahashi" : "Aoki") << std::endl;
  return 0;
}

#include <iostream>
#include <vector>
#include <map>
#include <iomanip>
#include <utility>
#include <cmath>
using namespace std;

template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}

typedef long long ll;
typedef pair<int, int> Pii;
typedef pair<ll, ll> Pll;
ll gcd(int a, int b){return b ? gcd(b, a%b) : a;}
ll lcm(int a, int b){return a*b / gcd(a, b);}


int main() {
    int a, b, w;
    cin >> a >> b >> w;

    int MAX = 0, MIN = 1000000;
    w *= 1000;
    for (int n = 1; n <= 1000000; ++n) {
        if(a * n <= w && b * n >= w){
            MAX = max(MAX, n);
            MIN = min(MIN, n);
        }
    }

    if(MAX == 0){
        cout << "UNSATISFIABLE" << endl;
    }
    else{
        cout << MIN << " " <<  MAX << endl;
    }
    return 0;
}
