CF1373B.01 Game

传统题 时间 2000 ms 内存 256 MiB 4 尝试 1 已通过 1 标签

01 Game

Alica and Bob are playing a game.

Initially they have a binary string ss consisting of only characters 0 and 1.

Alice and Bob make alternating moves: Alice makes the first move, Bob makes the second move, Alice makes the third one, and so on. During each move, the current player must choose two different adjacent characters of string ss and delete them. For example, if s=1011001s = 1011001 then the following moves are possible:

  1. delete s1s_1 and s2s_2: 101100111001\textbf{10}11001 \rightarrow 11001;
  2. delete s2s_2 and s3s_3: 1011001110011\textbf{01}1001 \rightarrow 11001;
  3. delete s4s_4 and s5s_5: 101100110101101\textbf{10}01 \rightarrow 10101;
  4. delete s6s_6 and s7s_7: 10110011011010110\textbf{01} \rightarrow 10110.

If a player can't make any move, they lose. Both players play optimally. You have to determine if Alice can win.

Input

First line contains one integer tt (1t10001 \le t \le 1000) — the number of test cases.

Only line of each test case contains one string ss (1s1001 \le |s| \le 100), consisting of only characters 0 and 1.

Output

For each test case print answer in the single line.

If Alice can win print DA (YES in Russian) in any register. Otherwise print NET (NO in Russian) in any register.

Note

In the first test case after Alice's move string ss become empty and Bob can not make any move.

In the second test case Alice can not make any move initially.

In the third test case after Alice's move string ss turn into 0101. Then, after Bob's move string ss become empty and Alice can not make any move.

Samples

3
01
1111
0011
DA
NET
NET

在线编程 IDE

建议全屏模式获得最佳体验