use std::io::{stdin, Read};

#[allow(unused_macros)]
macro_rules! parse {
    ($it: ident ) => {};
    ($it: ident, ) => {};
    ($it: ident, $var:ident : $t:tt $($r:tt)*) => {
        let $var = parse_val!($it, $t);
        parse!($it $($r)*);
    };
    ($it: ident, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = parse_val!($it, $t);
        parse!($it $($r)*);
    };
}

#[allow(unused_macros)]
macro_rules! parse_val {
    ($it: ident, [$t:tt; $len:expr]) => {
        (0..$len).map(|_| parse_val!($it, $t)).collect::<Vec<_>>();
    };
    ($it: ident, ($($t: ty),*)) => {
        ($(parse_val!($it, $t)),*)
    };
    ($it: ident, $t: ty) => {
        $it.next().unwrap().parse::<$t>().unwrap()
    };
}

fn simulate(a: usize, b: usize, c: usize, d: usize) -> bool {
    if a < b {
        return false;
    }
    if b > d {
        return false;
    }
    if c >= b - 1 {
        return true;
    }
    let mut seen = std::collections::HashSet::new();
    seen.insert(a);
    let mut a = a;
    loop {
        if a < b {
            return false;
        }
        a -= b;
        if a > c {
            let n = (a - c) / b;
            a -= n * b;
        }
        if a <= c {
            a += d;
        }
        if seen.contains(&a) {
            return true;
        }
        seen.insert(a);
    }
    return false;
}

fn solve(s: &str) {
    let mut it = s.split_whitespace();
    parse!(it, t: usize);
    for _ in 0..t {
        parse!(it, a: usize, b: usize, c: usize, d: usize);
        if simulate(a, b, c, d) {
            println!("Yes");
        } else {
            println!("No");
        }
    }
}

fn main() {
    let mut s = String::new();
    stdin().read_to_string(&mut s).unwrap();
    solve(&s);
}

#[cfg(test)]
mod tests {
    use super::*;
    #[test]
    fn test_input() {
        let s = "
        ";
        solve(s);
    }
}
