#include using namespace std; template typename enable_if::value, Ostream&>::type operator<<(Ostream& os, const Cont& v){ os << "[ "; for(auto &x : v) os << x << ' '; return os << "]"; } template Ostream& operator << (Ostream &os, const pair &p){ return os << "{" << p.first << ", " << p.second << "}"; } void dbg_cerr() { cerr << "\e[0m\n"; } template void dbg_cerr(Head H, Tail... T) { cerr << ' ' << H; dbg_cerr(T...); } #ifdef LTF #define DEBUG(...) cerr << "\e[1;31m[" #__VA_ARGS__ "]:", dbg_cerr(__VA_ARGS__) #else #define DEBUG(...) #endif void Solve() { int N, M; cin >> N >> M; int s, t, k; cin >> s >> t >> k; s--, t--; vector g(N, vector()); for (int i = 0; i < M; i++) { int x, y; cin >> x >> y; x--, y--; g[x].push_back(y), g[y].push_back(x); } if (N == 1) { assert(s == t); if (k == 0) cout << "Yes\n"; else cout << "No\n"; return; } vector dis(N, -1); queue q; dis[s] = 0, q.push(s); while (!q.empty()) { int u = q.front(); q.pop(); for (int v : g[u]) { if (dis[v] == -1) { dis[v] = dis[u] + 1; q.push(v); } } } DEBUG(dis[t]); if (dis[t] == -1) { if (N == 2 && (k % 2 == 0)) { cout << "No\n"; } else { cout << "Unknown\n"; } } else { if ((dis[t] ^ k) & 1) { // dis and k have different parity cout << "No\n"; } else { if (s == t) { if (k == 0) cout << "Yes\n"; else { bool flag = true; for (int u = 0; u < N; u++) { if (u != s) flag &= (dis[u] == -1); } if (flag) cout << "Unknown\n"; else cout << "Yes\n"; } } else { if (dis[t] <= k) cout << "Yes\n"; else cout << "Unknown\n"; } } } } int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); int T = 1; // cin >> T; while (T--) { Solve(); } return 0; }