#include <stdio.h>;
int Ind[300001];
int find(int p) {
while (p != Ind[p])
p = Ind[p];
return p;
}
void Union(int p, int q) {
int r1 = find(p);
int r2 = find(q);
Ind[r1] = r2;
}
void main() {
int N, a, b;
for (int i = 1; i <= N; i++)
{
Ind[i] = i;
}
if (N == 2)
{
}
else {
for (int i = 0; i < N-2; i++)
{
Union(a, b);
}
int root = find(1);
for (int i = 2; i <= N + 1; i++)
{
if (Ind[i] != root)
{
break;
}
}
}
}
I2luY2x1ZGUgPHN0ZGlvLmg+OwppbnQgSW5kWzMwMDAwMV07CgppbnQgZmluZChpbnQgcCkgewoJd2hpbGUgKHAgIT0gSW5kW3BdKQoJCXAgPSBJbmRbcF07CglyZXR1cm4gcDsKfQp2b2lkIFVuaW9uKGludCBwLCBpbnQgcSkgewoJaW50IHIxID0gZmluZChwKTsKCWludCByMiA9IGZpbmQocSk7CglJbmRbcjFdID0gcjI7Cn0KCnZvaWQgbWFpbigpIHsKCWludCBOLCBhLCBiOwoJc2NhbmYoIiVkIiwgJk4pOwoJZm9yIChpbnQgaSA9IDE7IGkgPD0gTjsgaSsrKQoJewoJCUluZFtpXSA9IGk7Cgl9CglpZiAoTiA9PSAyKQoJewoJCXByaW50ZigiMSAyIik7Cgl9CgllbHNlIHsKCQlmb3IgKGludCBpID0gMDsgaSA8IE4tMjsgaSsrKQoJCXsKCQkJc2NhbmYoIiVkICVkIiwgJmEsICZiKTsKCQkJVW5pb24oYSwgYik7CgkJfQoJCWludCByb290ID0gZmluZCgxKTsKCQlmb3IgKGludCBpID0gMjsgaSA8PSBOICsgMTsgaSsrKQoJCXsKCQkJaWYgKEluZFtpXSAhPSByb290KQoJCQl7CgkJCQlwcmludGYoIiVkICVkIiwgcm9vdCwgaSk7CgkJCQlicmVhazsKCQkJfQoJCX0KCX0KCWV4aXQoMCk7Cn0KCg==