recursive maximum function