Python implementation of manual solving logic tactics.