Baseball elimination problem (max flow algorithm)