#include <stdio.h>;
#include <stdlib.h>;
int Ind[300001];
int size[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);
if (r1 == r2) return;
if (size[r1]<size[r2])
{
Ind[r1] = r2;
size[r2] += size[r1];
}
else
{
Ind[r2] = r1;
size[r1] += size[r2];
}
}
void main() {
int N, a, b;
for (int i = 1; i <= N; i++)
{
Ind[i] = i;
size[i] = 1;
}
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; i++)
{
if (find(i) != root)
{
break;
}
}
}
}
I2luY2x1ZGUgPHN0ZGlvLmg+OwojaW5jbHVkZSA8c3RkbGliLmg+OwppbnQgSW5kWzMwMDAwMV07CmludCBzaXplWzMwMDAwMV07CmludCBmaW5kKGludCBwKSB7Cgl3aGlsZSAocCAhPSBJbmRbcF0pCgkJcCA9IEluZFtwXTsKCXJldHVybiBwOwp9CnZvaWQgVW5pb24oaW50IHAsIGludCBxKSB7CglpbnQgcjEgPSBmaW5kKHApOwoJaW50IHIyID0gZmluZChxKTsKCWlmIChyMSA9PSByMikgcmV0dXJuOwoJaWYgKHNpemVbcjFdPHNpemVbcjJdKQoJewoJCUluZFtyMV0gPSByMjsKCQlzaXplW3IyXSArPSBzaXplW3IxXTsKCX0KCWVsc2UKCXsKCQlJbmRbcjJdID0gcjE7CgkJc2l6ZVtyMV0gKz0gc2l6ZVtyMl07Cgl9Cn0KCnZvaWQgbWFpbigpIHsKCWludCBOLCBhLCBiOwoJc2NhbmYoIiVkIiwgJk4pOwoJZm9yIChpbnQgaSA9IDE7IGkgPD0gTjsgaSsrKQoJewoJCUluZFtpXSA9IGk7CgkJc2l6ZVtpXSA9IDE7Cgl9CglpZiAoTiA9PSAyKQoJewoJCXByaW50ZigiMSAyIik7Cgl9CgllbHNlIHsKCQlmb3IgKGludCBpID0gMDsgaSA8IE4tMjsgaSsrKQoJCXsKCQkJc2NhbmYoIiVkICVkIiwgJmEsICZiKTsKCQkJVW5pb24oYSwgYik7CgkJfQoJCWludCByb290ID0gZmluZCgxKTsKCQlmb3IgKGludCBpID0gMjsgaSA8PSBOOyBpKyspCgkJewoJCQlpZiAoZmluZChpKSAhPSByb290KQoJCQl7CgkJCQlwcmludGYoIiVkICVkIiwgcm9vdCwgaSk7CgkJCQlicmVhazsKCQkJfQoJCX0KCX0KCWV4aXQoMCk7Cn0KCg==