#include<bits/stdc++.h>
using namespace std;
int n,s,t,cnt,ans=numeric_limits<int>::max(),root,son,prt[200005],mak[200005],mp[5725][5725],dfn[200005],low[200005];
void dfs(int x)
{
low[x]=dfn[x]=++cnt;
for(int i=1;i<=n;i++)
{
if(prt[x]!=i&&mp[x][i])
{
if(!dfn[i])
{
prt[i]=x;
dfs(i);
low[x]=min(low[x],low[i]);
}
else
{
low[x]=min(low[x],dfn[i]);
}
}
}
}
void che(int x)
{
if(x==s)
{
return;
}
if(low[x]>=dfn[prt[x]]&&prt[x]!=s&&prt[x]<ans)
{
ans=prt[x];
}
che(prt[x]);
}
int main()
{
scanf("%d",&n);
int x,y;
while(~scanf("%d%d",&x,&y))
{
if(x+y==0)
{
break;
}
mp[x][y]=mp[y][x]=1;
}
scanf("%d%d",&s,&t);
dfs(s);
che(t);
if(ans==numeric_limits<int>::max())
{
printf("No solution");
}
else
{
printf("%d",ans);
}
return 0;
}
Subtask #1 一会MLE一会RE