British Informatics Olympiad 2011 Question 2