#include #include #define rep(i,n) for(int i=0;i vi; typedef vector vl; typedef vector> vvi; typedef vector> vvl; typedef long double ld; typedef pair P; ostream& operator<<(ostream& os, const modint& a) {os << a.val(); return os;} template ostream& operator<<(ostream& os, const static_modint& a) {os << a.val(); return os;} template ostream& operator<<(ostream& os, const dynamic_modint& a) {os << a.val(); return os;} template istream& operator>>(istream& is, vector& v){int n = v.size(); assert(n > 0); rep(i, n) is >> v[i]; return is;} template ostream& operator<<(ostream& os, const pair& p){os << p.first << ' ' << p.second; return os;} template ostream& operator<<(ostream& os, const vector& v){int n = v.size(); rep(i, n) os << v[i] << (i == n - 1 ? "\n" : " "); return os;} template ostream& operator<<(ostream& os, const vector>& v){int n = v.size(); rep(i, n) os << v[i] << (i == n - 1 ? "\n" : ""); return os;} template void chmin(T& a, T b){a = min(a, b);} template void chmax(T& a, T b){a = max(a, b);} template struct Edge_Dijkstra{ int from, to; T cost; Edge_Dijkstra(int from, int to, T cost) : from(from), to(to), cost(cost) {}; }; const int INF = 1001001001; template struct Dijkstra{ int n, m; vector initialized; vector> E; vector> G; map> dist; map> idx; Dijkstra(int _n) : n(_n), m(0), initialized(n, false), G(n){} void add_edge(int from, int to, T cost){ Edge_Dijkstra e(from, to, cost); E.push_back(e); G[from].emplace_back(m); m++; } void calc(int s){ initialized[s] = true; dist[s] = vector(n, INF); idx[s] = vector(n, -1); priority_queue, vector>, greater>> pq; pq.emplace(0, s, -1); while(pq.size()){ auto [cost, from, index] = pq.top(); pq.pop(); if(dist[s][from] <= cost) continue; dist[s][from] = cost; idx[s][from] = index; for(int index : G[from]){ int to = E[index].to; T cost_plus = E[index].cost; if(dist[s][to] <= cost + cost_plus) continue; pq.emplace(cost + cost_plus, to, index); } } } int farthest(int s){ if(!initialized[s]) calc(s); int idx = 0; rep(i, n) if(dist[s][i] > dist[s][idx]) idx = i; return idx; } T get_dist(int s, int t){ if(!initialized[s]) calc(s); return dist[s][t]; } vi restore(int s, int t){ if(!initialized[s]) calc(s); if(dist[s][t] == INF) return vi(0); vi res; while(idx[s][t] != -1){ auto e = E[idx[s][t]]; res.push_back(idx[s][t]); t = e.from; } reverse(res.begin(), res.end()); return res; } }; int main(){ int n, m; cin >> n >> m; int s, t, k; cin >> s >> t >> k; s--; t--; vvi G(n); Dijkstra graph(n); rep(i, m){ int u, v; cin >> u >> v; u--; v--; graph.add_edge(u, v, 1); graph.add_edge(v, u, 1); G[u].push_back(v); G[v].push_back(u); } int dist = graph.get_dist(s, t); if(dist >= INF){ cout << "Unknown\n"; }else{ int diff = abs(dist - k); if(diff % 2) cout << "No\n"; else{ if(s == t){ if(G[s].size() >= 1) cout << "Yes\n"; else cout << "No\n"; }else{ if(dist <= k) cout << "Yes\n"; else cout << "Unknown\n"; } } } return 0; }