http://informatics.mccme.ru/mod/statements/view3.php?id=207&chapterid=55 Задача B. Стек с защитой от ошибок Задача D. Простая очередь