#include <bits/stdc++.h>

const int N = 5e5 + 7;

int n, q, rt;
int head[N], to[N << 1], nxt[N << 1], edge_cnt;
void init() {
	edge_cnt = 0;
	memset(head, -1, sizeof head);
}
void add_edge(int u, int v) {
	to[edge_cnt] = v;
	nxt[edge_cnt] = head[u];
	head[u] = edge_cnt++;
}
int dep[N];
void dfs(int u, int f) {
	dep[u] = dep[f] + 1;
	for (int i = head[u]; ~i; i = nxt[i])
		if (to[i] != f)
			dfs(to[i], u);
}
struct Chtholly{
	int l, r;
};
std::set<Chtholly> odt;
std::set<Chtholly>::iterator split(int x) {
	
}
int main() {
	freopen("query.in", "r", stdin);
	freopen("query.out", "w", stdout);
	
	scanf("%d", &n);
	for (int i = 1, u, v; i < n; i++)
		scanf("%d%d", &u, &v), add_edge(u, v), add_edge(v, u);
	for (int i = 1; i <= n; i++)
		if (nxt[head[i]] == -1) {
			rt = i;
			break;
		}
	dfs(rt, 0);
}

