//https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};
    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };
    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };
    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };
    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };
    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

//

fn bfs(r: usize, g: &Vec<Vec<(i64, usize)>>) -> Vec<i64> {
    let mut d = vec![100000 + 1; g.len()];
    d[r] = 0;
    let mut q = std::collections::VecDeque::new();
    q.push_back(r);
    while let Some(v) = q.pop_front() {
        for &(_, u) in &g[v] {
            if d[u] > d[v] + 1 {
                d[u] = d[v] + 1;
                q.push_back(u);
            }
        }
    }
    d
}

fn run() {
    input! {
        n: usize,
        t: i64,
        src: usize1,
        dst: usize1,
        e: [(usize1, usize1, i64); n - 1],
    }
    if t == 0 {
        println!("Yes");
        return;
    }
    let mut g = vec![vec![]; n];
    for &(a, b, c) in e.iter() {
        g[a].push((c, b));
        g[b].push((c, a));
    }
    let d = bfs(src, &g);
    let mut between = vec![false; n];
    between[dst] = true;
    let mut now = dst;
    while now != src {
        let e = &g[now];
        for &(_, u) in e.iter() {
            if d[u] < d[now] {
                now = u;
                break;
            }
        }
        between[now] = true;
    }
    for &(a, b, c) in e.iter() {
        let v = if d[a] < d[b] {a} else {b};
        let u = a + b - v;
        if between[v] && between[u] {
            let deg = g[v].len() as i64;
            if deg * t >= c {
                println!("No");
                return;
            }
        }
    }
    for v in 0..n {
        let mut child = vec![];
        for &(c, u) in &g[v] {
            if d[u] < d[v] || between[u] {
                continue;
            }
            let deg = g[u].len() as i64;
            child.push((c - t * deg, u));
        }
        child.sort();
        for (i, &(c, _)) in child.iter().enumerate() {
            if v == src {
                if c <= t * i as i64 {
                    println!("No");
                    return;
                }
            } else if c <= t * (i + 1) as i64 {
                println!("No");
                return;
            }
        }
    }
    println!("Yes");
}

fn main() {
    run();
}



Measured memory_bytes: 23472