欢迎来到起遇信息学
起遇信息学正处于上线筹建阶段,以下功能已全部开放免费体验: ✅ 完整题库浏览与代码提交评测(C / C++ / Python / Java 等) ✅ 入门到进阶的系列课程试读、作业与考试 ✅ AI 提示、AI 作业分析等智能助教功能 ✅ 赛事模拟与个人能力报告 ✅ 邮箱注册开放 ⏳ 付费课程订阅与微信/支付宝支付通道 ⏳ 手机号登录,微信扫码登录、微信公众号绑定 使用中如遇任何问题,欢迎通过页面底部 **"联系我们"** 与我们沟通。
CF1982A.Soccer
Soccer
Dima loves watching soccer. In such a game, the score on the scoreboard is represented as : , where is the number of goals of the first team, and is the number of goals of the second team. At any given time, only one team can score a goal, so the score : can change to either : , or : .
While watching a soccer game, Dima was distracted by very important matters, and after some time, he returned to watching the game. Dima remembers the score right before he was distracted, and the score right after he returned. Given these two scores, he wonders the following question. Is it possible that, while Dima was not watching the game, the teams never had an equal score?
It is guaranteed that at neither of the two time points Dima remembers the teams had equal scores. However, it is possible that the score did not change during his absence.
Help Dima and answer the question!
Input
Each test consists of several test cases. The first line contains an integer () — the number of test cases. Then follows the description of the test cases.
The first line of each test case contains two integers (, ) — the score before Dima was distracted.
The second line of each test case contains two integers (, , ) — the score when Dima returned.
Output
For each test case, output "YES" without quotes if it is possible, that the teams never had a tie while Dima was away, otherwise output "NO" without quotes.
You can output each letter in any case (for example, the strings "yEs", "yes", "Yes", and "YES" will be recognized as a positive answer).
Note
In the first test case, the score before Dima left was : . When he leaves, the first team scores several goals in a row until the score becomes : , so the answer is YES.
In the second test case, the score could only change as follows:
- :
- :
- :
In this scenario, there is a moment when the teams have an equal score, so the answer is NO.
In the third test case, one of the possible developments is:
- :
- :
- :
- :
- :
- :
- :
In this scenario, there was no time when the score was equal, so the answer is YES.
Samples
6
1 0
5 0
1 2
3 2
1 2
4 5
1 2
4 3
1 2
1 2
998244353 0
1000000000 999999999
YES
NO
YES
NO
YES
YES
在线编程 IDE
建议全屏模式获得最佳体验
| 进入全屏编程 | Alt+E |
| 递交评测 | Ctrl+Enter |
| 注释/取消注释 | Ctrl+/ |
| 缩放字体 | Ctrl+滚轮 |