#include using namespace std; #define ALL(x) x.begin(),x.end() #define rep(i,n) for(int i=0;i<(n);i++) #define debug(v) cout<<#v<<":";for(auto x:v){cout<bool chmax(T &a,const T &b){if(abool chmin(T &a,const T &b){if(b ostream &operator<<(ostream &os,const pair&p){ os< ostream &operator<<(ostream &os,const vector&v){ for(int i=0;i<(int)v.size();i++) os< istream &operator>>(istream &is,pair&p){ is>>p.first>>p.second; return is; } template istream &operator>>(istream &is,vector&v){ for(T &x:v)is>>x; return is; } signed main(){ int n,m,p;cin>>n>>m>>p; int s,t;cin>>s>>t;s--,t--; vector> g(n); rep(i,m){ int u,v;cin>>u>>v;u--,v--; g[u].push_back(v); g[v].push_back(u); } using P=pair; vector> ds(n,vector(2,INF)),dt(n,vector(2,INF)); auto fi=[&](int st,vector> &d){ queue

que; d[st][0]=0; que.push(P(st,0)); while(!que.empty()){ auto [now,p]=que.front();que.pop(); for(auto to:g[now]){ if(chmin(d[to][p^1],d[now][p]+1)) que.push(P(to,p^1)); } } }; fi(s,ds); fi(t,dt); vector ans; rep(i,n){ if(p%2){ // odd if(ds[i][0]+dt[i][1]<=p or ds[i][1]+dt[i][0]<=p)ans.push_back(i); }else{ if(ds[i][0]+dt[i][0]<=p or ds[i][1]+dt[i][1]<=p)ans.push_back(i); } } if(ans.empty())cout<<-1<