记录
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e6+5;
map<int,vector<int>>graph;
int dfn[MAXN],low[MAXN],cnt=0,a,b;
bitset<MAXN>vis,flag;
void Tarjan(int x){
vis[x]=true;
dfn[x] = low[x] = ++cnt;
for(auto i:graph[x]){
if(!vis[i]){
Tarjan(i);
low[x] = min(low[x],low[i]);
if(x!=a && low[i]>=dfn[x] && dfn[x]<=dfn[b]){
flag[x] = true;
}
}
else{
low[x] = min(low[x],dfn[i]);
}
}
}
int main() {
int n;
scanf("%d",&n);
while(1){
int x,y;
scanf("%d%d",&x,&y);
graph[x].push_back(y);
graph[y].push_back(x);
if(!x && !y)break;
}
scanf("%d%d",&a,&b);
Tarjan(a);
for(int i=1;i<=n;i++){
if(flag[i]){
cout<<i;
return 0;
}
}
cout<<"No solution";
return 0;
}