spoj#STCKHOLM. Get-Together at Stockholm

Get-Together at Stockholm

Please click here to download a PDF version of the contest problems. The problem is problem G in the PDF. Remember that you must use stdin/stdout at SPOJ.