http://acm.timus.ru/problem.aspx?space=1&num=1196

BufferedInputStream
accepted