atcoder#ARC105E. [ARC105E] Keep Graph Disconnected

[ARC105E] Keep Graph Disconnected

Score : 700700 points

Problem Statement

Given is an undirected graph GG consisting of NN vertices numbered 11 through NN and MM edges numbered 11 through MM. Edge ii connects Vertex aia_i and Vertex bib_i bidirectionally.

GG is said to be a good graph when both of the conditions below are satisfied. It is guaranteed that GG is initially a good graph.

  • Vertex 11 and Vertex NN are not connected.
  • There are no self-loops and no multi-edges.

Taro the first and Jiro the second will play a game against each other. They will alternately take turns, with Taro the first going first. In each player's turn, the player can do the following operation:

  • Operation: Choose vertices uu and vv, then add to GG an edge connecting uu and vv bidirectionally.

The player whose addition of an edge results in GG being no longer a good graph loses. Determine the winner of the game when the two players play optimally.

You are given TT test cases. Solve each of them.

Constraints

  • All values in input are integers.
  • 1T1051 \leq T \leq 10^5
  • 2N1052 \leq N \leq 10^{5}
  • 0Mmin(N(N1)/2,105)0 \leq M \leq \min(N(N-1)/2,10^{5})
  • 1ai,biN1 \leq a_i,b_i \leq N
  • The given graph is a good graph.
  • In one input file, the sum of NN and that of MM do not exceed 2×1052 \times 10^5.

Input

Input is given from Standard Input in the following format:

TT

case1\mathrm{case}_1

\vdots

caseT\mathrm{case}_T

Each case is in the following format:

NN MM

a1a_1 b1b_1

\vdots

aMa_M bMb_M

Output

Print TT lines. The ii-th line should contain First if Taro the first wins in the ii-th test case, and Second if Jiro the second wins in the test case.

3
3 0
6 2
1 2
2 3
15 10
12 14
8 3
10 1
14 6
12 6
1 9
13 1
2 5
3 9
7 2
First
Second
First
  • In test case 11, Taro the first wins. Below is one sequence of moves that results in Taro's win:- In Taro the first's turn, he adds an edge connecting Vertex 11 and 22, after which the graph is still good.
    • Then, whichever two vertices Jiro the second would choose to connect with an edge, the graph would no longer be good.
    • Thus, Taro wins.
  • In Taro the first's turn, he adds an edge connecting Vertex 11 and 22, after which the graph is still good.
  • Then, whichever two vertices Jiro the second would choose to connect with an edge, the graph would no longer be good.
  • Thus, Taro wins.