結果

問題 No.361 門松ゲーム2
ユーザー antaanta
提出日時 2016-04-20 18:34:07
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 27,438 bytes
コンパイル時間 112 ms
コンパイル使用メモリ 23,296 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-10-04 14:27:39
合計ジャッジ時間 995 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 0 ms
6,816 KB
testcase_01 AC 0 ms
6,816 KB
testcase_02 AC 1 ms
6,816 KB
testcase_03 AC 1 ms
6,816 KB
testcase_04 AC 0 ms
6,816 KB
testcase_05 AC 1 ms
6,816 KB
testcase_06 AC 0 ms
6,816 KB
testcase_07 AC 1 ms
6,820 KB
testcase_08 AC 0 ms
6,820 KB
testcase_09 AC 1 ms
6,816 KB
testcase_10 AC 0 ms
6,820 KB
testcase_11 AC 1 ms
6,820 KB
testcase_12 AC 1 ms
6,816 KB
testcase_13 AC 0 ms
6,816 KB
testcase_14 AC 1 ms
6,820 KB
testcase_15 AC 1 ms
6,820 KB
testcase_16 AC 1 ms
6,820 KB
testcase_17 AC 0 ms
6,820 KB
testcase_18 AC 1 ms
6,820 KB
testcase_19 AC 0 ms
6,820 KB
testcase_20 AC 0 ms
6,816 KB
testcase_21 AC 1 ms
6,816 KB
testcase_22 AC 0 ms
6,816 KB
testcase_23 AC 0 ms
6,820 KB
testcase_24 AC 0 ms
6,820 KB
testcase_25 AC 1 ms
6,816 KB
testcase_26 AC 0 ms
6,816 KB
testcase_27 AC 1 ms
6,816 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cstdio>
using namespace std;

int main() {
	const char *table[206] = {
		"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
		"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
		"aecbaaaaaaecjecjecjecjecjecjecbaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaecjecjecjecjecjecjecjecjecjecjecjec",
		"ampbobaamdmdmdmdmpppppppbobobobobobobobobobobobobobaaaaaaaaaaaaaaaaaaaamdmdmdmdmdmdmdmdmdmdmdmdmdmdmdmdmdmdmdmdmdmdmdmdmdmdmdm",
		"ampbphaabhombbaembpppphpofadgmnlhhmibeponppppnlhbmibompbaaaaaaaaaamppppppppphhphmjdhomjdheiabceiabcemjdhomjdhmpnnppppppppphaaa",
		"ampjpbbappppiemhpppppphophaaaaaaaiopiopgpphpbhepphaaaaaaaaaaaaaaaamppppaaaampdpppppppppppppppppppppppampampampampamhfjekkpaaaa",
		"ampnpjhbppfmpnmphhhhhmfnbobapfnbhbbhdehphopgjpphpphhhemfmfmfembbppppkppppmdpbpampphpboihjpohohonbnampppppppphpppnnegphafapohpp",
		"ampnpnpnpbmpmbmppbmpephmhmphmpnpppppponpnpbampbampbampbmpbpfodifnnmnpnnbmnkhmpbbpmppppppppppphiphahapbmdmpmlmjkgppppppppphapbp",
		"ampnpppphiphmppaaaaaaampppdpappaphohpppphpppdipppppppppppppppppppppppphaaaaaophmholpphgiphpppphjhonpdpnoifphhmpbabaaaampppphdh",
		"ampnpppphiphmpaaaaaaaapppplpbapohhphjpplppppppppppppppppppppppppppppphaaaaacojpokppppppppphippopppfohhhphkplndmppjoopppppppaaa",
		"ampnpppphiphmdhaaophampppplpfipkhpkhjppppppppppppppppppppppppppppppphaaaaaipdodopphppppplpppnkpplplhjonppppphoppppdphaaaaaaaaa",
		"ampnpppphnphodplppphpppfopnplpheldppppnhpppjpoppppidaabpbhophphdidpapnopjppipbohlpcofopppdopnppppppppppppppppemppppppppppppppp",
		"ampnppppppphpmppmpddaaaamdaaamppppppppppppophphhjhoppppppppppppppppppppppppppppppppppppppppppdaaaaaaaaaaaaaaaaaaaaaaophplppppp",
		"ampnppppppphppphopbhaaaapbihahpnnlpnmpppdopppmpponpappppppppppppppppppppppppppppppppppppppppppphppphopdppjppopppomhmppppdpphnp",
		"ampnpppppppppppbpdahaaaidaibaiaaiopaamoppppppphgpppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppplippphaa",
		"ampnpppppppppppbpdahaaeidaibaiaaaihaaailpppppppgpppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppplipp",
		"ampnppppppppppphphahaagidaaaaaaaaigpljpppppppnppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppahaaafmp",
		"ampnppppppppppphppbhaahidaaaaaaiaiopplppppppppppopjppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppphpppphpp",
		"ampnppppppppppphppbhaghidaaaaaamooppphpnppppppnhofipppppppppppppppppppppppppppppppppppppppppppppppppppphoppppdnfhmppppppppppmf",
		"ampnpppppppppppbppbbapaihaaaaaonppppppppppppppohppphppppppppppppppppppppppppppppppppppppppppppppppphnpiaaaaaaaaddpnphopjnppinl",
		"ampnpppppppppppbppnbaaaaaaaaaaonpppppppppppppppblhpplpppppppppppppppppppppppppppppppppppppppppppppppbpbhaaaaaaaaaaaipibhgppbcp",
		"ampnpppppppppppbppndbaaaaaaaaoopppppppppphppppopphoppppppppppppppppppppppppppppppppppppppppppppppccodaaaaaaaaaaaaaajlpppppppjh",
		"ampnpppppppppppbppnhhahopbaaipppppppppppppppppppppopppppppppppppppppppppppppppppppppppppppppppppdampdpbmpbihobaaaaaaibaaaaaipd",
		"ampnpppppppppppbppnppbompdihppppppppppppppppplppopopppppppppppppppppppppppppppppppppppppppppppdaaaaallpppppbaaaaaipppppppppnlm",
		"ampnpppppppppppfppnpphpphhmpppppppppppppppppppphpppppppppppppppppppppppppplpppppppppppppjppppppppppppppppppnphpppppppphpplpnob",
		"ampnppppppppppppppndpplppnppppppplhppppppphnpcppppppppppppppppppppppppppppppppppppppppopppppppppppppppplpppppppplppppppppphlmg",
		"ampnppppppppppppppnpppppppppdoppppppnpppppppppppnppppppnppppppppopnpdmpppphpppdoppppppppppppppppppppppppppppppppppppppppnpppop",
		"ampnppppppppppppppppppppppppbphmppphpppppphpndpolbojbipahpcjmlmbbpfhemdippppppppppppppppppppppppppppppoppplpppppppoppppppppplp",
		"ampnppppppppppppppppppppppppbphmppphpppppphpndpolbojbipahpcjmlodbofhamdippppppppppppppppppppppppppplppopppppppppppoppppppppppp",
		"ampnpppppppppppppppppppppppppphmpnphpppppphjidoolfcibipahpcjakoabcedaiaaeopplcpppppppppppppopppppppppppppppppppppppppppppppppp",
		"ampnpppppppppppppppppppppppppphmpnpppppppphlkdoolhcibihahoabacoaaaedaaaafppppkppppppppppppppppppphpppppppppppppppppppppppppppp",
		"ampnpppppppppppppppppppppppppphmpnpppppppphlldpolhcibidehoaaaaoaaaedaaaipppppppppppppppppppoppppphppppplpppppplppppppppppppppp",
		"ampnpppppppppppppppppppppppppppmpnpppppppphlidfaceapbophaaaneppepbedahaaaaainppppppppppppppppphopppphlphpppppppppppppppppppppp",
		"ampnpppppppppppppppppppppppppppmpnpppppppphjmdjdceapbodaaaaaampambedahaaaaaaippppppppppppppppphppppppppppppppopppppnpppppppppp",
		"ampnpppppppppppppppppppppppppppmpnpppppppphjmdjdcaambidaaaaaaapambadahaaaaaaopppppppppppppppppppppppoppopppppoplpppppppppppppp",
		"ampnpppppppppppppppppppppppppppmpnpppppppphjmdjdcabmbihaaaaaaipfppppipeabaaaopppppppppppppppppppppphoppopppppppppppppppppppppp",
		"ampnpppppppppppppppppppppppppppmpnpppppppphjmdjdcadmbipaaaiofpphpppppmhadbecmppppppppppppppppppppppdoppopppppppppppppppppppppp",
		"ampnpppppppppppppppppppppppppppmpnpppppppphjacidaadmbmdaaeionppdndmnamaapppppppppppppppppppppppppppppppppppppppppppppppppppppp",
		"ampnpppppppppppppppppppppppppppmpnpppppppphjacidaabpambaagionppjnbmpamdapppppppppppppppppppppjpppppppppppppppppppppppppppppppp",
		"ampnpppppppppppppppppppppppppppopnpppppppphjacopoanpppbaihmppppppppppphkpmpjppppppppppppppppmhpppopppppppppppppppppppppppppppp",
		"ampnpppppppppppppppppppppppppppopppppppppphbaaoppbppppdakpmppppoppppmppopnphpplppoppppppppdpmhdpdppppppppppppppppppppppppppppp",
		"ampnpppppppppppppppppppppppppppoppppppppppbbaaihkdnpppdkhppppppppppphapppppppplppiippppppppmppcppppppppppppppppppppppppppppppp",
		"ampnpppppppppppppppppppppppppppoppppppppppbbahehmpppplhnnppppppnppppplppppppppjppiaopppppppppjaopppppppppppppppppppppppppppppp",
		"ampnpppppppppppppppppppppppppppppppppppppnbbapmpopphphpppppppppppppjaaipplmpppaeobadamjpppohmbaaaaaaihpbpmpppppppppppppppppppp",
		"ampnpppppppppppppppppppppppppppppppppppdpnbidolpppppopppppppppppppphnpppppppppbpobodbmjpppphmbaaaijpphpjpppppppppppppppppppppp",
		"ampnpppppppppppppppppppppppppppppppppppdpnbojpppppppppppppppppppppppbpplppdppplmhdildiiheopdaaaacodppppppppppppppppppppppppppp",
		"ampnpppppppppppppppppppppppppppppppppppdpbaojppppppnppppppppppppppppmpplppdppplpaaappppepppppppppppppppppppppppppppppppppppppp",
		"ampnpppppppppppppppppppppppppppppppppppdpbooppppppppppppppppppppppppppllppdhpjppmacaappipppppppppphppppppppppppppppppppppppppp",
		"ampnpppppppppppppppppppppppppppppppppppdpjpppppppppppppppppppppnpppppppdopddaiphpcpdcopdpppppppppppppppppppppppppppppppppppppp",
		"ampnppppppppppppppppppppppppppppppppppplppppppppppppppppppppoppppppppppdipddaipflgpdhmhbphppihompppppppppppppppppppppppppppppp",
		"ampnppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppaphaaimpiplppnpdpplpailhdoocapaoamaidaibmhhaaaaaaaaaaa",
		"ampnppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppnpplapdapnnopkdapbppppodcdiiaaacameaobdaaaibapbidaaaaaaaaa",
		"ampnpppppppppppppppppppppppppppppppppppppdopppppppppppppppppppppppoppmphmpdipdjpolpnpppppnpppdhhpnmlpppppppppppppppppppppppppp",
		"ampnppppppppppppppppppppppppppppppppppppppppppppppppppppplppppppppppppphopbmpbihkppldppmhkppmfbodigadagaaaaaaaaaihaipippmipdmp",
		"ampnppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppphopbmpamdkppldppmhkppmnaodigadagaaamamdaamdaibihhaidama",
		"ampnppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppmpbmpamhkppllppmpipjifaobagabagagaiaidmaibaaaaaaaaaaaa",
		"ampnppppppppppppppppppppppppppppppppppppppppppppppppppppplppppppppppppppmpbapamdkppdjodipapbaaaaaaaaaaaadaiaidgaibaaaaaaaaaaaa",
		"ampnpppppppppppppppppppppppppppppppppppppppppppppppppppppjpppppppppppnppmpampaohipnhbidmpamaaaaaaaaaaaaidaiaidhaibaaaaaaaaaaaa",
		"ampnpppppppppppppppppppppppppppppppppppppppppppppppppppphipppppppppppnppmpaohaobapndaidopamaaaaaaaaaaaamdaiailhaibaaaaaaaaaaia",
		"ampnpppppppppppppppppppppppppppppppppppppppppppppppppppppjpppppppppppnppmpaohaohapndamdopamaaaaaaaaaaaamdaiailhaibaaaaaaaaaaia",
		"ampnpppppppppppppppppppppppppppppppppppppppppppppppppppppjpppppppppppnppmpaohaohapndamdopamaaaaaaaaaaaamdaiailhaibaaaaaaaaaaia",
		"ampnpppppppppppppppppppppppppppppppppppppppppppppppppphppjpppppppppppnphmpaohaohmpnlaedopamaaaaaaaaaaaamdaiailhaibaaaaaaaaaaia",
		"ampnpppppppppppppppppppppppppppppppppppppppppppppppppphppjpppppppppppnphmpaohiphmpnlaedopamaaaaaaaaaaaamdaiailhaibaaaaaaaaaaaa",
		"ampnpppppppppppppppppppppppppppppppppppppppppppppppppphppjpppppppppppnphmpaohmphopnlaedopamaaaaaaaaaaaamdilailhaibaaaaaaaaaaaa",
		"ampnpppppppppppppppppppppppppppppppppppppppppppppppppphppappppppphpppnpgmpaohmphppaiaaaaaaaaaaaaaaaaaaamdmlailhaibaaaaaaaaaaaa",
		"ampnpppppppppppppppppppppppppppppppppppppppppppppppppphppappppppphpppnpgmpaohmphppaiaaaaaaaaaaaaaaaaaaamdmlaiphaibaaaaaaaaaaaa",
		"ampnpppppppppppppppppppppppppppppppppppppppppppppppppphppappppppphpppnpgmhaohmphppoiaaaaaaaaaaaaaaaaaaamdmlaiphaibaaaaaaaaaaaa",
		"ampnpppppppppppppppppppppppppppppppppppppppppppppppppphppappppppphpppnpgmhaohmphpppiaaaaaaaaaaaaaaaaagamdmlmiphaibaaaaaaaaaaaa",
		"ampnpppppppppppppppppppppppppppppppppppppppppppppppppphppappppppphpppnpgmhappmphpppiaaaaaaaaaaaaaaaaahamdmloiphaibaibaaadogglo",
		"ampnpppppppppppppppppppppppppppppppppppppppppppppppppphppappppppphpppnpgmhippmphpppiaaaaaaaaaaaaaaaaahamdmloiphaibaibaaidogopp",
		"ampnpppppppppppppppppppppppppppppppppppppppppppppppppphppapppppppppppnpgmpmppmphpppiaaaaaaaaaaaaaaaaahamdmloiphaibaibaapdppppp",
		"ampnpppppppppppppppppppppppppppppppppppppppppppppppppphppapnppppphpnpnpgmpmppmphpppaamaaaaaaaaaaaaaaahamdmdoamhaaaaaaaippppppp",
		"ampnpppppppppppppppppppppppppppppppppppppppppppppppppphppapnppppphpnpnpgmpmppmphpppaipaaaaaaaaaaaaaaahamdmdoamhaaaaaaamppppppp",
		"ampnpppppppppppppppppppppppppppppppppppppppppppppppppphppapnppppphpnpnpgmpmppmphpppaipaaaaaaaaaaaaaaahamdmdoamhidaaibaoppppppp",
		"ampnpppppppppppppppppppppppppppppppppppppppppppppppppphppapnppppphpnpnpgmpmppmphpppaipdaaaaaaaaaaaaaahamdmdoamhmdaaibapppppppp",
		"ampnpppppppppppppppppppppppppppppppppppppppppppppppppphppapnppppphpnpnpompoppophpppaipdaacaaaaaaaaaaahamdmdoaohodaambipppppppp",
		"ampnpppppppppppppppppppppppppppppppppppppppppppppppppphppapnppppphpnpnppmppppophpppaipdaacaaaaaaaaaeahamdmdoaohodaampppppppppp",
		"ampnpppppppppppppppppppppppppppppppppppppppppppppppppphppapnppppphpnpnppoppppophpppampdaacaaaaaaaaagahaodmdoaohodaampppppppppp",
		"ampnpppppppppppppppppppppppppppppppppppppppppppppppppphppapnppppphpnpnpgmpaopopppppampaaaccaaaaaaaaaahaodmdoaopppppppppppppppp",
		"ampnpppppppppppppppppppppppppppppppppppppppppppppppppphppappppppphpnpnpgmhaohophppdampaaacdaaaaaaaaaahaodmdoaohodaaopppppppppp",
		"ampnpppppppppppppppppppppppppppppppppppppppppppppppppphppappppppphpnpnpgmhaohophppbamdaaakdaaaaaaaahmppppppolphopbeeeapppppppp",
		"ampnpppppppppppppppppppppppppppppppppppppppppppppppppphppappppppphpnpnpgmhaopophpphamdaaakdaaaaaaaapmppppppppppppppppppppppppp",
		"ampnpppppppppppppppppppppppppppppppppppppppppppppppppphppappppppphpnpnpgmhaopophpphambaaakdaaaaaaaapnppppppppppppppppppppppppp",
		"ampnpppppppppppppppppppppppppppppppppppppppppppppppppphppappppppphpnpnpgmpaopophpphambaaakdaaaaaaaapnppppppppppppppppppppppppp",
		"ampnpppppppppppppppppppppppppppppppppppppppppppppppppphppappppppphpnpnpgmpaopophpphambaaakdaaaaaaaaojppppppppppppppppppppppppp",
		"ampnpppppppppppppppppppppppppppppppppppppppppppppppppphppappppppphpnpnpgmpaopophpphambiaakdaaaaaaaambppppppppppppppppppppppppp",
		"ampnpppppppppppppppppppppppppppppppppppppppppppppppppphppappppppphpnpnpgmpaopophpphambmaakdaaaaaaaaaahamdmpppppppppppppppppppp",
		"ampnpppppppppppppppppppppppppppppppppppppppppppppppppphppappppppphpnpnpgmpaopophpphamboaakdaaaaaaaaaahamdmpppppppppppppppppppp",
		"ampnpppppppppppppppppppppppppppppppppppppppppppppppppphppappppppphpnpnpgmpaopophpphamboaakdaaaaaaaaaahamdmpppppppppppppppppppp",
		"ampnpppppppppppppppppppppppppppppppppppppppppppppppppphppappppppphpnpnpgmpaopophpphamboaakdaaaaaaaaaahamdmpppppppppppppppppppp",
		"ampnpppppppppppppppppppppppppppppppppppppppppppppppppphppappppppphpnpnpgmpaopophpphambaaaaaaaaaaaaaaaaaaaaoppppppppppppppppppp",
		"ampnpppppppppppppppppppppppppppppppppppppppppppppppppphppappppppphpnpnpgoppppppppphambaaaaafaaaaaaaaaaaaaipppppppppppppppppppp",
		"ampnpppppppppppppppppppppppppppppppppppppppppppppppppphppappnpppphpnpnhhopppppppppbaaaaaaaandaacaaaaaaaaampppppppppppppppppppp",
		"ampnpppppppppppppppppppppppppppppppppppppppppppppppppphppappnpppphpnpnhhmhaohophppbaaaaaaaanhaacaipopppppppppppppppppppppppppp",
		"ampnpppppppppppppppppppppppppppppppppppppppppppppppppphppippppppphpnpnhhmpppppppppbaaaaaaehphaacampppppppppppppppppppppppppppp",
		"ampnpppppppppppppppppppppppppppppppppppppppppppppppppphppjppppppphpnpnhpmpppppphppbaadaajnpppbbcampppppppppppppppppppppppppppp",
		"ampnpppppppppppppppppppppppppppppppppppppppppppppppppphppjppppppphpnpnhppppppppppphaiknbaeopppbpampppppppppppppppppppppppppppp",
		"ampnpppppppppppppppppppppppppppppppppppppppppppppppppphppjppppppphpnppppppppppppppppnpnpploppppppppppppppppppppppppppppppppppp",
		"ampnpppppppppppppppppppppppppppppppppppppppppppppppppphppjppppppphpnppppppppppppppndmpfppppppppppppppppppppppppppppppppppppppp",
		"ampnpppppppppppppppppppppppppppppppppppppppppppppppppphppjppppppphpnppppppppppppppppppnppnpppppppppppppppppppppppppppppppppppp",
		"ampnpppppppppppppppppppppppppppppppppppppppppppppppppphppjppppppphpnpppppppppppppppppppppppppppppppppppppppppppppppppppppppppp",
		"ampnpppppppppppppppppppppppppppppppppppppppppppppppppphppjpppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppp",
		"ampnpppppppppppppppppppppppppppppppppppppppppppppppppphppjpppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppp",
		"ampnpppppppppppppppppppppppppppppppppppppppppppppppppppppjppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppmppppppp",
		"ampnpppppppppppppppppppppppppppppppppppppppppppppppppppppnpppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppp",
		"ampnppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppphpp",
		"ampnpppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppp",
		"ampnpppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppnpp",
		"ampnpppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppp",
		"ampnpppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppphpppphpppppppp",
		"ampnpppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppphpppphpppppppp",
		"ampnpppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppphpppphpppppppp",
		"ampnpppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppphpppphpppppppp",
		"ampnpppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppphpppphpppppppp",
		"ampnpppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppphpppphpppppppp",
		"ampnpppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppphpppphpppppppp",
		"ampnppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppdppophpppppppp",
		"ampnppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppdppophpppppppp",
		"ampnppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppdppophpppppppp",
		"ampnppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppdppophpppppppp",
		"ampnppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppdppophpppppppp",
		"ampnppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppdppophpppppppp",
		"ampnppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppdppophpppppppp",
		"ampnppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppdpppphpppppppp",
		"ampnppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppdpppphpppppppp",
		"ampnppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppdpppphpppppppp",
		"ampnppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppdpppphpppppppp",
		"ampnppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppdpppphpppppppp",
		"ampnppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppdpppphpppppppp",
		"ampnppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppdpppphpppppppp",
		"ampnppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppdpppphpppppppp",
		"ampnppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppdpppphpppppppp",
		"ampnppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppdpppphpppppppp",
		"ampnppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppphapppphppppppmp",
		"ampnppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppphapppphppppppmp",
		"ampnppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppphapppphppppppmp",
		"ampnppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppphapppphppppppmp",
		"ampnppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppphapppphppppppmp",
		"ampnppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppphapppphppppppmp",
		"ampnppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppphapppphppppppmp",
		"ampnppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppphapppphppppppmp",
		"ampnppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppphapppphppppppmp",
		"ampnppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppphapppphppppppmp",
		"ampnppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppphapppphppppppmp",
		"ampnppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppphapppphppppppmp",
		"ampnppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppphapppphppppppmp",
		"ampnppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppphapppphppppppmp",
		"ampnppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppphapppphppppppmp",
		"ampnppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppphapppphppppppmp",
		"ampnppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppphapppphppppppmp",
		"ampnppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppphapppphppppppmp",
		"ampnppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppphapppphppppppmp",
		"ampnppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppphapppphppppppmp",
		"ampnppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppphapppphppppppmp",
		"ampnppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppphapppphppppppmp",
		"ampnppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppphapppphppppppmp",
		"ampnppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppapppphppppppmp",
		"ampnppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppbpppphppppppmp",
		"ampnppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppdpppphppppppmp",
		"ampnppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppdpppphppppppmp",
		"ampnppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppdpppphppppppmp",
		"ampnppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppdpppphppppppmp",
		"ampnpppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppphoppppppphppppppmp",
		"ampnpppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppphoppppppphppppppmp",
		"ampnpppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppphoppppppphppppppmp",
		"ampnpppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppphoppppppphppppppmp",
		"ampnpppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppoppppppphppppppmp",
		"ampnpppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppoppppppphppppppmp",
		"ampnpppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppoppppppphppppppmp",
		"ampnpppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppoppppppphppppppmp",
		"ampnpppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppoppppppphppppppmp",
		"ampnpppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppoppppppphppppppmp",
		"ampnpppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppoppppppphppppppmp",
		"ampnpppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppoppppppphppppppmp",
		"ampnpppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppoppppppppppppppmp",
		"ampnpppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppopnppppphppppppmp",
		"ampnpppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppopnppppphppppppmp",
		"ampnpppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppopnppppphppppppmp",
		"ampnpppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppopnppppphppppppmp",
		"ampnpppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppopnppppphppppppmp",
		"ampnpppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppopnppppphppppppmp",
		"ampnpppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppopnppppphppppppmp",
		"ampnpppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppopnppppphppppppmp",
		"ampnpppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppopnppppphppppppmp",
		"ampnpppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppopnppppphppppppmp",
		"ampnpppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppopnppppphppppppmp",
		"ampnpppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppopnppppphppppppmp",
		"ampnpppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppoppppppphpppppppp",
		"ampnpppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppoppppppphpppppppp",
		"ampnpppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppoppppppphpppppppp",
		"ampnpppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppoppppppphpppppppp",
		"ampnpppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppoppppppphpppppppp",
		"ampnpppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppoppppppphpppppppp",
		"ampnpppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppoppppppphpppppppp",
		"ampnpppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppoppppppphpppppppp",
		"ampnpppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppoppppppphpppppppp",
		"ampnpppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppoppppppphpppppppp",
		"ampnpppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppoppppppphpppppppp",
		"ampnpppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppoppppppphpppppppp",
		"ampnppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppphpppppppp",
		"ampnppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppphpppppppp",
		"ampnppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppphpppppppp",
		"ampnppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppopppphpppppppp",
		"ampnppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppopppphpppppppp",
		"ampnppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppopppphpppppppp",
		"ampnpppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppp",
	};
	int L, D;
	while(~scanf("%d%d", &L, &D)) {
		bool ans = (table[D > 205 ? 205 : D][L / 4] - 'a') >> (L % 4) & 1;
		puts(ans ? "kado" : "matsu");
	}
	return 0;
}
0