#include <bits/stdc++.h>
const int N = 2e5 + 5;
int n, m, s, t, tot, scc, ans = 1e9, top, child, dfn[N], low[N], stack[N];
bool haves[N], havet[N];
std::vector<int> edge[N];
void Dfs(int, int);
void Dfss(int);
signed main() {
scanf("%d", &n);
scanf("%d%d", &s, &t);
while (s && t) {
edge[s].push_back(t);
edge[t].push_back(s);
scanf("%d%d", &s, &t);
}
scanf("%d%d", &s, &t);
haves[s] = true;
havet[t] = true;
for (int i = 1; i <= n; i++)
if (!dfn[i]) {
child = 0;
Dfs(i, i);
}
if (ans == 1e9)
printf("No solution");
else
printf("%d", ans);
return 0;
}
void Dfs(int u, int fa) {
dfn[u] = low[u] = ++tot;
for (int v : edge[u]) {
if (dfn[v]) {
if (v != fa)
low[u] = std::min(low[u], dfn[v]);
continue;
}
Dfs(v, u);
haves[u] |= haves[v];
havet[u] |= havet[v];
low[u] = std::min(low[u], low[v]);
if (u == fa) {
child++;
if (child > 1 && (haves[v] ^ havet[v]) && u != s && u != t)
ans = std::min(ans, u);
} else if (low[v] >= dfn[u] && (haves[v] ^ havet[v]) && u != s && u != t)
ans = std::min(ans, u);
}
}