#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; namespace utils{ #define ALL(x) begin(x), end(x) #define RALL(x) rbegin(x), rend(x) ///----- aliases using ll = long long int; using ull = unsigned long long; template using p_queue = priority_queue, Compare>; template using min_queue = p_queue>; template using max_queue = p_queue>; template inline bool CHMIN(T& X, const T& A){ if(X > A) {X = A; return true;} return false; } template inline bool CHMAX(T& X, const T& A){ if(X < A) {X = A; return true;} return false; } ///----- vector I/O template vector VEC(size_t n, T t){ return vector(n, t); } template auto VEC(size_t n, Ts ... ts){ return vector(n, VEC(ts...)); } template istream& operator>>(istream& is, vector& v){ for (auto &&x : v) { is >> x; } return is; } template ostream& operator<<(ostream& os, const vector& v){ auto p = v.begin(); assert(p != v.end()); os << *p++; while(p != v.end()){ os << ' ' << *p++; } return os ; } template ostream& operator<<(ostream& os, const vector>& v){ auto p = v.begin(); assert(p != v.end()); os << *p++; while(p != v.end()){ os << '\n' << *p++; } return os; } ///----- tuple I/O template istream& operator>>(istream& is, tuple& t){ return is >> get<0>(t) >> get<1>(t); } template istream& operator>>(istream& is, pair& t){ return is >> get<0>(t) >> get<1>(t); } template istream& operator>>(istream& is, tuple& t){ return is >> get<0>(t) >> get<1>(t) >> get<2>(t); } template ostream& operator<<(ostream& os, const tuple& t){ return os << get<0>(t) << ' ' << get<1>(t); } template ostream& operator<<(ostream& os, const pair& t){ return os << get<0>(t) << ' ' << get<1>(t); } template ostream& operator<<(ostream& os, const tuple& t){ return os << get<0>(t) << ' ' << get<1>(t) << ' ' << get<2>(t); } ///----- constants constexpr ll INFLL = 1'000'000'000'000'000'020ll; constexpr ll INF = 1'000'000'009; constexpr double PI = 3.14'159'265'358'979'323'846; constexpr double EPS = 1e-12; } using namespace utils; class solver{ istream& is; ostream& os; public: solver(istream& I, ostream& O) :is(I), os(O) {} int N, M; int s, t, k; vector> F; bool input() { N = M = 0; is >> N >> M; is >> s >> t >> k; s--; t--; F.resize(N); for (int i = 0; i < M; ++i) { int a, b; is >> a >> b; a--; b--; F[a].push_back(b); F[b].push_back(a); } // end i return !!is; } void run(); }; void solver::run(){ if(!input()) return; vector d(N, -1); set L, R; L.insert(s); queue qv; queue qd; qv.push(s); qd.push(0); d[s] = 0; while(!qv.empty()){ int vi = qv.front(); int di = qd.front(); qv.pop(); qd.pop(); for (auto &&u: F[vi]) { if(d[u] == -1){ qv.push(u); qd.push(d[u] = di+1); if(di % 2){ L.insert(u); } else { R.insert(u); } } } // end u } // not connected if(d[t] == -1){ os << "Unknown\n"; return; } bool tr = R.count(t); if((k % 2) != tr){ os << "No\n"; return; } if(d[t] <= k){ os << "Yes\n"; return; } os << "Unknown\n"; } int main(int argc, char *argv[]) { cin.tie(nullptr); ios::sync_with_stdio(false); cout << setprecision(16) << scientific; #ifdef XELMH string test_cases = "test_c.txt"; cerr << test_cases << " -->" << endl; auto fs = fstream(test_cases, fstream::in); int loop = 0; while(fs) { loop++; cout << '#' << loop << "#------\n"; solver(fs, cout).run(); } if(loop <= 1) { cout << "===" << endl; while(cin) solver(cin, cout).run(); } #else solver(cin, cout).run(); #endif return 0; }