SP5160 O2JAM - Jinyuetuan Puzzle

Description

Please click [here](http://www.spoj.com/content/john_jones:shanghai2009.pdf) to download a PDF version of the contest problems. The problem is problem J in the PDF.

Input Format

N/A

Output Format

N/A