After a lot of discussions, the Mayor's advisers have recommended to accept any proposal that increases the distance between any two intersections by a factor A augmented by a constant B, with respect to the old configuration (i.e., if the actual distance from one intersection to another is x, then the new distance should be at most A · x + B).

You are hired to develop a program to decide if a given proposal to orient city blocks satisfies the requirements.
There are several cases to analyze. Each case is described with a set of lines:
The last test case is followed by a line containing a single '0'.
For each case print one line with the word 'Yes' if the proposal satisfies the given requirements, or the word 'No' otherwise, and the maximum value of all the shortest paths between two intersections in the orginal traffic network.