A solution to POJ 1988