code for poj for personal interest.