#include using namespace std; using pii = pair; using ll = long long; #define rep(i, j) for(int i=0; i < (int)(j); i++) #define repeat(i, j, k) for(int i = (j); i < (int)(k); i++) #define all(v) v.begin(),v.end() #define debug(x) cerr << #x << " : " << x << endl template bool set_min(T &a, const T &b) { return a > b ? a = b, true : false; } template bool set_max(T &a, const T &b) { return a < b ? a = b, true : false; } // vector template istream& operator >> (istream &is , vector &v) { for(T &a : v) is >> a; return is; } template ostream& operator << (ostream &os , const vector &v) { for(const T &t : v) os << "\t" << t; return os << endl; } // pair template ostream& operator << (ostream &os , const pair &v) { return os << "<" << v.first << ", " << v.second << ">"; } const int INF = 1 << 30; const ll INFL = 1LL << 60; class Solver { public: int L, D; bool solve() { cin >> L >> D; if(D == 1) { cout << "matsu" << endl; } vector grundy(L + 1); rep(l, grundy.size()) { if(l < 6) { grundy[l] = 0; } else if(D == 2 and (l - 6) % 3 != 0) { grundy[l] = 0; } else { set reachable; cerr << "@@@@@@@@ " << l << " @@@@@@" << endl; repeat(L1, 1, l + 1) { repeat(L2, L1 + 1, l - L1 + 1) { int L3 = l - L1 - L2; if(L3 <= L2 or L3 - L1 > D) break; cerr << "!" << endl; cerr << L1 << " " << L2 << " " << L3 << endl; cerr << grundy[L1] << " " << grundy[L2] << " " << grundy[L3] << endl; cerr << (grundy[L1] ^ grundy[L2] ^ grundy[L3]) << endl; reachable.insert(grundy[L1] ^ grundy[L2] ^ grundy[L3]); } } int mex = 0; for(int g : reachable) { if(mex == g) mex++; } grundy[l] = mex; } } debug(grundy); cout << (grundy.back() != 0 ? "kado" : "matsu") << endl; return 0; } }; int main() { cin.tie(0); ios::sync_with_stdio(false); Solver s; s.solve(); return 0; }