SP185 CHASE1 - Chase
Description
Chase is a two-person board game. A board consists of squares numbered from 1 to _n_. For each pair of different squares it is known if they are adjacent to one another or they are not. Each player has a piece at his disposal. At the beginning of a game pieces of players are placed on fixed, distinct squares. In one turn a player can leave his piece on the square it stands or move it to an adjacent square.
A game board has the following properties:
- it contains no triangles, i.e. there are no three distinct squares such that each pair of them is adjacent,
- each square can be reached by each player.
Input Format
The number of test cases _t_ is in the first line of input, then _t_ test cases follow separated by an empty line.
In the first line of a test case there are four integers _n_, _m_, _a_ and _b_ separated by single spaces, where 2
Output Format
For each test case you should output one line containing:
- one word "No", if player B cannot catch player A, or
- one integer - the number of turns needed by B to catch A (if B can catch A).