use input::input_array; use std::collections::VecDeque; use Ans::*; fn main() { let [n, m] = input_array::(); let [start, end, k] = input_array::(); let start = start - 1; let end = end - 1; let mut g = vec![Vec::new(); n]; for _ in 0..m { let [i, j] = input_array::(); let i = i - 1; let j = j - 1; g[i].push(j); g[j].push(i); } let mut dist = vec![std::usize::MAX; g.len()]; dist[start] = 0; let mut queue = VecDeque::from(vec![start]); while let Some(x) = queue.pop_front() { for &y in &g[x] { if dist[y] == std::usize::MAX { dist[y] = dist[x] + 1; queue.push_back(y); } } } let d = dist[end]; let ans = match () { () if d == !0 => { if n == 2 && k % 2 == 0 { No } else { Unknown } } () if d % 2 != k % 2 => No, () if k < d => Unknown, () => Yes, }; println!( "{}", match ans { Yes => "Yes", No => "No", Unknown => "Unknown", } ); } #[derive(Clone, Copy)] enum Ans { Yes, No, Unknown, } // input {{{ #[allow(dead_code)] mod input { use std::cell::Cell; use std::convert::TryFrom; use std::io::stdin; use std::io::BufRead; use std::io::BufReader; use std::io::Lines; use std::io::Stdin; use std::str::FromStr; use std::sync::Mutex; use std::sync::Once; type Server = Mutex>>; static ONCE: Once = Once::new(); pub struct Lazy(Cell>); unsafe impl Sync for Lazy {} fn line() -> String { static SYNCER: Lazy = Lazy(Cell::new(None)); ONCE.call_once(|| { SYNCER .0 .set(Some(Mutex::new(BufReader::new(stdin()).lines()))); }); unsafe { (*SYNCER.0.as_ptr()) .as_ref() .unwrap() .lock() .unwrap() .next() .unwrap() .unwrap() } } pub trait ForceFromStr: FromStr { fn force_from_str(s: &str) -> Self; } impl ForceFromStr for T where T: FromStr, E: std::fmt::Debug, { fn force_from_str(s: &str) -> Self { s.parse().unwrap() } } pub fn input_array() -> [T; N] where T: std::fmt::Debug, { <[_; N]>::try_from(input_vec()).unwrap() } pub fn input_vec() -> Vec { line() .split_whitespace() .map(T::force_from_str) .collect::>() } pub fn input() -> T { T::force_from_str(&line()) } } // }}}