Asa's Chess Problem

HihoCoder - 1424