#include using namespace std; typedef signed long long ll; #define _P(...) (void)printf(__VA_ARGS__) #define FOR(x,to) for(x=0;x<(to);x++) #define FORR(x,arr) for(auto& x:arr) #define FORR2(x,y,arr) for(auto& [x,y]:arr) #define ALL(a) (a.begin()),(a.end()) #define ZERO(a) memset(a,0,sizeof(a)) #define MINUS(a) memset(a,0xff,sizeof(a)) template bool chmax(T &a, const T &b) { if(a bool chmin(T &a, const T &b) { if(a>b){a=b;return 1;}return 0;} //------------------------------------------------------- int N,M,S,G; vector E[202020]; int ord[202020],low[202020]; int id; int D[202020]; int dp[202020]; void dfs(int cur,int pre) { ord[cur]=low[cur]=id++; FORR(e,E[cur]) if(e!=pre) { if(ord[e]!=-1) { low[cur]=min(low[cur],ord[e]); } else { dfs(e,cur); low[cur]=min(low[cur],low[e]); } } } void solve() { int i,j,k,l,r,x,y; string s; cin>>N>>M>>S>>G; S--,G--; FOR(i,M) { cin>>x>>y; E[x-1].push_back(y-1); E[y-1].push_back(x-1); } MINUS(ord); id=0; dfs(S,S); if(ord[G]==-1) { cout<<-1< Q; Q.push(S); while(Q.size()) { int cur=Q.front(); Q.pop(); if(cur==G) { cout<=low[e])+(ord[e]=low[cur]); dp[e]=max(dp[e],tar); } } } } int main(int argc,char** argv){ string s;int i; if(argc==1) ios::sync_with_stdio(false), cin.tie(0); FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin); cout.tie(0); solve(); return 0; }