#P8943. Rachel and Michael’s Perilous Pursuit

    ID: 22107 Type: Default 1000ms 256MiB

Rachel and Michael’s Perilous Pursuit

Rachel and Michael’s Perilous Pursuit

Rachel and Michael are trapped aboard the "Goya" while Delta II is relentlessly tracking them down using radar. Fortunately, both sides can see each other’s location via their own radars.

The ship’s interior consists of n rooms connected by n corridors forming a connected undirected graph. It is guaranteed that the graph does not contain any cycle formed by 4 or fewer corridors (i.e. any cycle has length at least 5). Every minute, both Rachel (playing as piece A) and Delta II (playing as piece B) must move simultaneously along one corridor to an adjacent room.

If at any moment the two pieces either end up in the same room or traverse the same corridor in opposite directions at the same time, Delta II wins immediately. However, if after 10^{10^{9961}} moves Delta II has not succeeded in catching Rachel, then Rachel wins.

Both players are supremely intelligent and will never make a move that puts themselves at a disadvantage. Rachel has q questions: if she starts in room x while Delta II starts in room y, can she avoid capture and survive indefinitely?


Formal Statement:

You are given a connected undirected graph with n nodes and n edges. The graph does not contain any cycle with at most 4 edges. You will be given q queries. In each query, a token A is placed at node x and token B at node y. In every move both tokens are forced to move along one edge simultaneously. If at any move the tokens meet at the same node or cross the same edge (i.e. they swap positions by moving along the same edge in opposite directions), then token B wins. If token B cannot force a win within 10^{10^{9961}} moves then token A is declared the winner.

Both players play optimally. For each query, output Survive if A wins or Deception if B wins.

Note: Under optimal play, it turns out that delta II (B) can always force a capture regardless of the starting positions. (In other words, the answer for every query is Deception.)

inputFormat

The input begins with an integer n (n ≥ 2), the number of rooms. Then follow n lines, each containing two integers u and v (1 ≤ u,vn), denoting a corridor connecting room u and room v. It is guaranteed that the graph is connected and has exactly one cycle, and that every cycle in the graph has length at least 5.

The next line contains an integer q (the number of queries). Each of the following q lines contains two integers x and y (1 ≤ x,yn), indicating that token A starts at room x and token B starts at room y.

outputFormat

For each query, output one line containing the answer. Print Survive if token A can avoid capture indefinitely under optimal play, otherwise print Deception if token B can force a win.

Note: Under optimal play, token B can always force capture so the correct answer for every query is Deception.

sample

2
1 2
1 2
1
1 2
Deception

</p>