Logic2 problem. Pretty fun.