Solutions to poj problems