Hakoiri musume ("daughter in the box") puzzle implemenation in C