U468170 pull the box

题目描述

输入格式

Each test contains multiple test cases. The first line contains the number of test cases $t$ ($1≤t≤10^5$). The description of the test cases follows. The first line of each test case contains three integers $n,m,x$ ($3≤n≤10^6,0≤m≤10^6,2≤x≤n$), representing the number of nodes, the number of edges, and the starting node of the player, respectively. The next $m$ lines each contain two integers $u,v (1≤u,v≤n,u\not=v)$, representing an undirected edge connecting nodes $u$ and $v$. It is guaranteed that there is no multiple edges or self-loops. It is guaranteed that the sum of $n$ over all test cases does not exceed $10^6$ , and the sum of $m$ over all test cases does not exceed $10^6$.

输出格式

For each test case, if the player can achieve the game’s goal, output “Vegetable fallleaves” on the first line, and on the second line, output the minimum number of moves required to achieve the goal. Otherwise, output “Boring Game” in a single line.

说明/提示

In sample case 2: Initially, the player is at point 4, and the box is at point 1. The player moves along 4→5→6. (2 moves in this step. 2 moves in total.) The player pulls the box to point 6. The player goes to point 5. (1 move in this step. 3 moves in total.) The player moves along 5→3→2→1. (3 moves in this step. 6 moves in total.) The player pulls the box to point 1. The player goes to point 8. (1 move in this step.7 moves in total.) The player pulls the box to point 8. The player goes to point 7. (1 move in this step. 8 moves in total.) The player moved through 8 edges in total and achieved the goal. So you output “Vegetable fallleaves” in the first line. As 8 can be shown to be the minimum moves required to achieve the goal, you output “8” in the second line.