#include <bits/stdc++.h>
#define MAX (200000 + 7)
#define add push_back
using namespace std;
int f1,f2;
int T,N,M,K,cnt,ans1,c[MAX],LOW[MAX],DFN[MAX],ans2;
int ans=10000;
int root=0;
vector <int> g[MAX],DCC[MAX];
stack <int> S;
void init()
{
while(S.size()) S.pop();
for(int i=0;i<MAX;i++)
{
g[i].clear();
DCC[i].clear();
root=0;cnt=0;
DFN[i]=0;LOW[i]=0;c[i]=0;
}
}
void Tarjan(int x)
{
int fa = 0; S.push(x);
LOW[x] = DFN[x] = ++cnt;
for (int p = 0; p < g[x].size(); p++)
{
const int y = g[x][p];
if (!DFN[y])
{
Tarjan(y);
LOW[x] = min(LOW[x], LOW[y]);
if(x==root) fa++;
if (LOW[y] >= DFN[x])
{
K++;
if(x!=root) c[x]=1;
DCC[K].push_back(x);
if(x==f1) ans1++;
if(x==f2) ans2++;
int z = 0;
do{
z = S.top(); S.pop();
if(z==f1) ans1++;
if(z==f2) ans2++;
DCC[K].add(z);
}while (z != y);
if(ans1+ans2==1&&x!=f1&&x!=f2) ans=min(ans,x);
}
}
else LOW[x] = min(LOW[x], DFN[y]);
}
}
int main()
{
int n;
cin>>n;
int u,v;
while(cin>>u>>v,u,v)
{
g[u].push_back(v);
g[v].push_back(u);
}
cin>>f1>>f2;
for(int i=1;i<=n;i++)
{
if(DFN[i]==0)
{
root=i;
Tarjan(i);
}
}
if(ans==10000) cout<<"No solution";
else cout<<ans;
return 0;
}