Don't Close the Loop
The planning office of Nodeville has n numbered towns and no roads yet. The office has
already fixed the exact order in which m roads will be paved: road i connects towns u_i
and v_i. Alice and Bob pave the roads in that fixed order, taking turns starting with Alice —
Alice paves road 1, Bob paves road 2, Alice paves road 3, and so on.
Paving a road is only useful if it lets you reach a town you couldn't reach before. Whenever the
two endpoints of a road are already connected by roads paved so far — including the road being
a self-loop (u_i = v_i), or literally the same pair of towns having appeared earlier in the
schedule — the road being paved is pointless, and whoever pours it is fired on the spot. That
person loses immediately, and no further roads get paved.
If the entire schedule of m roads gets paved without this ever happening, nobody loses: it's a
draw.
Given the fixed schedule, determine who loses and on which road, or report that it's a draw.
Input
The first line contains two integers n and m (1 ≤ n ≤ 2·10^5, 0 ≤ m ≤ 2·10^5) — the number
of towns and the number of scheduled roads.
Each of the next m lines contains two integers u_i and v_i (1 ≤ u_i, v_i ≤ n) — the two
towns that road i connects. It is possible that u_i = v_i, and the same pair of towns may
appear more than once across the whole schedule.
Output
If some road causes a loss, print the name of the loser (Alice or Bob) and the 1-indexed
position of that road in the schedule, separated by a single space. Alice paves the odd-numbered
roads and Bob the even-numbered ones.
If no road ever causes a loss (in particular when m = 0), print DRAW.
Notes
In the first example, the three roads 1–2, 3–4 and 2–3 connect every pair of towns they touch for the first time, so the whole schedule is paved without incident: the answer is a draw.
In the second example, road 1 (1–2) and road 2 (2–3) each connect previously unconnected towns, but by the time road 3 (1–3) is paved, towns 1 and 3 are already connected through town 2. Road 3 is the third road in the schedule, an odd position, so Alice is the one who paves it and loses.