This page is still under construction.

Parts of this page are still being built. What you see may change.

Do Not Disturb!

Time limit1sMemory limit128 MB

Summary
Two people wander a graph at random each step, and you must find the expected time until both reach node C at once.
Level

Medium7 of 10

Topics
Probability, Matrix, Graph
Solved
No attempts yet

Problem

Nicole and Noura work on the media team of a regional contest. While the contest runs, Noura walks the contest hall photographing the teams, meets Nicole and hands the photos over, and Nicole posts them on the contest's Facebook page. So that the teams are left alone, the contest director fixed a set of corridors the two may walk while they do this. The corridors cross one another and together they form a graph.

Formally, you are given a graph whose nodes are the crossing points and the endpoints of the corridors, together with bidirectional edges joining the nodes. Two nodes are neighbors when an edge joins them. Walking along one edge takes 11 unit of time.

When the contest starts, Nicole stands on node AA and Noura stands on node BB. The two nodes may be the same. During each unit of time each of them picks one neighboring node and moves there, or picks to stay on the current node for the whole unit. A node with dd neighbors gives d+1d + 1 choices, and each choice is picked with the same probability 1d+1\frac{1}{d + 1}. The two of them pick independently of each other.

The machine used for uploading stands on node CC. Compute the expected number of time units until the two of them stand on node CC at the same moment for the first time.

Input

The first line has one integer TT, the number of test cases.

The first line of each test case has two space separated integers VV and EE, the number of nodes and the number of edges.

The second line has three space separated integers AA, BB and CC. AA is the starting node of Nicole, BB is the starting node of Noura, and CC is the index of the node where they have to meet.

Each of the next EE lines has two space separated integers FF and GG, meaning that an undirected edge joins node FF and node GG. At most one edge joins any pair of nodes, and no edge joins a node to itself.

  • 1≤T≤201 \le T \le 20
  • 1≤V≤201 \le V \le 20
  • 0≤E≤V(V−1)20 \le E \le \frac{V(V-1)}{2}
  • AA, BB, CC, FF and GG are zero based indices between 00 and V−1V-1, and F≠GF \ne G.

Output

For each test case print on a single line the expected number of time units rounded to three decimal places. If the two of them can never stand on node CC at the same moment, print Impossible instead.

In every test the exact expected value is at least 10−510^{-5} away from a rounding boundary, meaning a value whose fourth decimal digit is 55 with only zeros after it. The rounded answer is therefore unique.

Examples1

  1. Example 1

    Input
    3
    3 2
    0 2 1
    0 1
    2 1
    1 0
    0 0 0
    2 1
    0 0 1
    0 1
    
    Expected output
    4.800
    0.000
    4.000