CF1999C.Showering

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

Showering

As a computer science student, Alex faces a hard challenge — showering. He tries to shower daily, but despite his best efforts there are always challenges. He takes ss minutes to shower and a day only has mm minutes!

He already has nn tasks planned for the day. Task ii is represented as an interval (li(l_i, ri)r_i), which means that Alex is busy and can not take a shower in that time interval (at any point in time strictly between lil_i and rir_i). No two tasks overlap.

Given all nn time intervals, will Alex be able to shower that day? In other words, will Alex have a free time interval of length at least ss?

In the first test case, Alex can shower for the first 33 minutes of the day and not miss any of the tasks.

Input

The first line contains a single integer tt (1t1041 \leq t \leq 10^4) — the number of test cases.

The first line of each test case contains three integers nn, ss, and mm (1n21051 \leq n \leq 2 \cdot 10^5; 1s,m1091 \leq s, m \leq 10^9) — the number of time intervals Alex already has planned, the amount of time Alex takes to take a shower, and the amount of minutes a day has.

Then nn lines follow, the ii-th of which contains two integers lil_i and rir_i (0li<rim0 \leq l_i \lt r_i \leq m) — the time interval of the ii-th task. No two tasks overlap.

Additional constraint on the input: li>ri1l_i \gt r_{i-1} for every i>1i \gt 1.

The sum of nn over all test cases does not exceed 21052 \cdot 10^5.

Output

For each test case output "YES" (without quotes) if Alex can take a shower for that given test case, and "NO" (also without quotes) otherwise.

You can output "YES" and "NO" in any case (for example, strings "yEs", "yes", and "Yes" will be recognized as a positive response).

Samples

4
3 3 10
3 5
6 8
9 10
3 3 10
1 2
3 5
6 7
3 3 10
1 2
3 5
6 8
3 4 10
1 2
6 7
8 9
YES
YES
NO
YES

在线编程 IDE

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