CF 1371 C. A Cookie for You


time limit per test : 1 second
memory limit per test : 256 megabytes
input : standard input
output : standard output

Description

Anna is a girl so brave that she is loved by everyone in the city and citizens love her cookies. She is planning to hold a party with cookies. Now she has a vanilla cookies and b chocolate cookies for the party.

She invited n guests of the first type and m guests of the second type to the party. They will come to the party in some order. After coming to the party, each guest will choose the type of cookie (vanilla or chocolate) to eat. There is a difference in the way how they choose that type:

If there are v vanilla cookies and c chocolate cookies at the moment, when the guest comes, then

  • if the guest of the first type: if v>c the guest selects a vanilla cookie. Otherwise, the guest selects a chocolate cookie.
  • if the guest of the second type: if v>c the guest selects a chocolate cookie. Otherwise, the guest selects a vanilla cookie.

After that:

  • If there is at least one cookie of the selected type, the guest eats one.
  • Otherwise (there are no cookies of the selected type), the guest gets angry and returns to home.

Anna wants to know if there exists some order of guests, such that no one guest gets angry. Your task is to answer her question.

Input

The input consists of multiple test cases. The first line contains a single integer t (1≤t≤1000) — the number of test cases. Next t lines contain descriptions of test cases.

For each test case, the only line contains four integers a, b, n, m (0≤a,b,n,m≤1e18,n+m≠0).

Output

For each test case, print the answer in one line. If there exists at least one valid order, print "Yes". Otherwise, print "No".

You can print each letter in any case (upper or lower).

Example

input

6
2 2 1 2
0 100 0 1
12 13 25 1
27 83 14 25
0 0 1 0
1000000000000000000 1000000000000000000 1000000000000000000 1000000000000000000

output

Yes
No
No
Yes
No
Yes

Note

Note
In the first test case, let's consider the order {1,2,2} of types of guests. Then:

  • The first guest eats a chocolate cookie. After that, there are 2 vanilla cookies and 1 chocolate cookie.

  • The second guest eats a chocolate cookie. After that, there are 2 vanilla cookies and 0 chocolate cookies.

  • The last guest selects a chocolate cookie, but there are no chocolate cookies. So, the guest gets angry.

So, this order can't be chosen by Anna.

Let's consider the order {2,2,1} of types of guests. Then:

  • The first guest eats a vanilla cookie. After that, there is 1 vanilla cookie and 2 chocolate cookies.

  • The second guest eats a vanilla cookie. After that, there are 0 vanilla cookies and 2 chocolate cookies.

  • The last guest eats a chocolate cookie. After that, there are 0 vanilla cookies and 1 chocolate cookie.

So, the answer to this test case is "Yes".

In the fifth test case, it is illustrated, that the number of cookies (a+b) can be equal to zero, but the number of guests (n+m) can't be equal to zero.

In the sixth test case, be careful about the overflow of 32-bit integer type.

Solution

 这题首先想到的是两种情况,人数和饼干数的关系,只有在人数小于等于饼干数的情况下可以进一步分析。在满足最基本的条件下,我们可以分析第一类人和第二类人的行为,第一类人比较灵活,可以说是为了吃V而吃,在V充足的情况下吃V,反之吃C以达到V>C的情况而吃V;第二类人则是哪个少吃哪个。于是乎我们可知第二类比较特殊,所以我们先考虑第二类人,再考虑第一类人,又因为第一类人不管怎么样都能吃到所以只要第二类人吃到那么都可以吃到。

 我们于是比较第二类人的数量与最少饼干的数量,如果人数大于饼干数,则吃不到,反之。所以整体思路便是先判断总人数和饼干数,再判断第二类人数和饼干数。

#include<iostream>
#define ll long long
using namespace std;
int main(){
    int n;
    cin>>n;
    ll a,b,v,c;
    while(n--){
        cin>>v>>c>>a>>b;
        if(a+b>v+c) cout<<"No\n";
        else if(b>min(v,c)) cout<<"No\n";
        else cout<<"Yes\n";
    }
    return 0;
}