#include using namespace std; #define int long long #define rep(i, l, r) for (int i = (int)(l); i < (int)(r); i++) #define all(x) (x).begin(), (x).end() #define sz(x) ((int)x.size()) template bool chmax(T &a, T b) { if (a < b) { a = b; return 1; } return 0; } template bool chmin(T &a, T b) { if (a > b) { a = b; return 1; } return 0; } template using V = vector; using P = pair; /* */ int d; int memo[501]; int dfs(int x){ if(memo[x] >= 0) return memo[x]; set s; rep(i, 1, x) rep(j, i+1, x+1){ int k = x - (i+j); if(k == i or k == j or k < 1 or max({i, j, k})-min({i, j, k}) > d) continue; s.insert(dfs(i) ^ dfs(j) ^ dfs(k)); } int res = 0; while(s.count(res)) res++; return memo[x] = res; } signed main() { fill(memo, memo+501, -1); int l; cin >> l >> d; cout << (dfs(l) ? "kado" : "matsu") << endl; return 0; }