Second task of the PCMagazine programming contest 2012-2013