CF1954A.Painting the Ribbon

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

Painting the Ribbon

Alice and Bob have bought a ribbon consisting of nn parts. Now they want to paint it.

First, Alice will paint every part of the ribbon into one of mm colors. For each part, she can choose its color arbitrarily.

Then, Bob will choose at most kk parts of the ribbon and repaint them into the same color (he chooses the affected parts and the color arbitrarily).

Bob would like all parts to have the same color. However, Alice thinks that this is too dull, so she wants to paint the ribbon in such a way that Bob cannot make all parts have the same color.

Is it possible to paint the ribbon in such a way?

Input

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

Each test case consists of one line containing three integers nn, mm and kk (1m,kn501 \le m, k \le n \le 50) — the number of parts, the number of colors and the number of parts Bob can repaint, respectively.

Output

For each test case, print YES if Alice can paint the ribbon so that Bob cannot make all parts have the same color. Otherwise, print NO.

You can print every letter in any register. For example, Yes, yes, yEs will all be recognized as positive answer.

Note

In the first test case, a ribbon consists of 11 part. So all its parts will always have the same color.

In the second test case, there is only 11 color.

In the third test case, Alice can paint the ribbon as follows: [1,2,1,2,1][1, 2, 1, 2, 1]. It's impossible to change the color of at most 11 part so that all parts have the same color.

In the fourth test case, no matter how Alice paints the ribbon, Bob will always be able to repaint 22 parts so that all parts have the same color.

In the fifth test case, Alice can paint the ribbon as follows: [1,2,3,4,5][1, 2, 3, 4, 5]. It's impossible to change the color of at most 33 parts so that all parts have the same color.

Samples

5
1 1 1
5 1 1
5 2 1
5 2 2
5 5 3
NO
NO
YES
NO
YES

在线编程 IDE

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