Solves P31 (naive impl)
Solves P32
Solves P33