#include <iostream>
#include <cstdio>
#include <queue>
#include <cmath>
#include <random>
#include <fstream>
#include <string>

#define REP(i, N) for(int i = 0; i< N; i++)
using namespace std;
#define ll long long
const int INF = 1 << 29;

const int mod = 1000000007;

/*int mondaiC(){
    int N;
    string S;
    cin >> N;
    cin >> S;
    int j = 0;
    char isshodenaito[2][20] = {0};
    int mae = 0;
    int k =0;
    int l = 0;
    int kara[2] = {0};
    queue <char> isshojanaito1;
    queue <char> isshojanaito2;
    kara[0] = -1;
    kara[1] = -1;
    while(kara[0] < N - 1){
        kara[0]++;
        kara[1]++;
        isshojanaito1.push(S[kara[0]]);
        mae = 0;
        do{
            if(mae == 0){
                do{
                    printf("%c",isshojanaito1.front());
                    j++;
                    while(isshojanaito1.front() != S[2 * N - 1 - kara[1]]){
                        isshojanaito2.push(S[2 * N - 1 - kara[1]]);
                        kara[1]++;
                    }
                    isshojanaito1.pop();
                }while(j < kara[0]);
                mae = 1;
            }else{
                do{
                    k++;
                    printf("%c",isshojanaito2.front());
                    while(isshojanaito2.front() != S[kara[0]]){
                        isshojanaito1.push(S[kara[0]]);
                        kara[0]++;
                    }
                    isshojanaito2.pop();
                }while(k < kara[1]);
                mae = 0;
            }
        }while(kara[0] != kara[1]);
        l ++;
    }
    printf("%d,%d\n",j, k);
    return 0;
}
*/
int mondaiB(){
    int T;
    cin >> T;
    ll A[310];
    ll B[310];
    ll C[310];
    ll D[310];
    REP(i, T){
        cin >> A[i] >> B[i] >> C[i] >> D[i];
    }
    REP(i, T){
        if(A[i] < B[i])printf("No\n"); //
        else if(A[i] % B[i] > C[i])printf("No\n"); //
        else if(B[i] > D[i]) printf("No\n");
        else if(B[i] <= C[i]) printf("Yes\n");
        else if(D[i] % B[i] == 0)printf("Yes\n");
        else if(D[i] % B[i] < B[i] - C[i])printf("No\n");
        else if(D[i] % B[i] > B[i] - C[i]){
            if((A[i] % B[i]) % (D[i] % B[i]) >C[i] % (D[i] % B[i]) || C[i] % (D[i] % B[i]) < B[i] - C[i])printf("No\n");
            else printf("Yes\n");
        }
        else if((A[i] % B[i]) % (D[i] % B[i]) == C[i] % (D[i] % B[i]))printf("Yes\n");
        else printf("No\n");
    }
    return 0;
}

int mondaiA(){
    int N;
    cin >> N;
    int a[110];
    int chigau = 0;
    int kaeru = 0;
    REP(i, N){
        cin >> a[i];
        if(i > 0 && a[i] == a[i -1]){
            chigau ++;
        }else{
            kaeru += (chigau + 1) / 2;
            chigau = 0;
        }
    }
    kaeru += (chigau + 1) / 2;
    printf("%d\n", kaeru);
    return 0;
}

int main(){
    mondaiC();
}
