This problem is based on ideas contributed by Graeme Brown and Lyndon Baker.