# include <bits/stdc++.h>
/*
// ordered_set 
# include <ext/pb_ds/assoc_container.hpp>
# include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
# define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
*/
 
using namespace std;
 
typedef long long                                        ll;
typedef long double                                      ld;
typedef pair <int, int>                                  pii;
typedef pair <pii, int>                                  ppi;
typedef pair <int, pii>                                  pip;
typedef pair <pii, pii>                                  ppp;
typedef pair <ld, ld>                                  pll;
 
# define A                                               first
# define B                                               second
# define endl                                            '\n'
# define sep                                             ' '
# define all(x)                                          x.begin(), x.end()
# define kill(x)                                         return cout << x << endl, 0
# define SZ(x)                                           int(x.size())
# define Sort(x)                                         sort(all(x))
# define InTheNameOfGod                                  ios::sync_with_stdio(0);cin.tie(0); cout.tie(0);
 
ll power(ll a, ll b, ll md) {return (!b ? 1 : (b & 1 ? a * power(a * a % md, b / 2, md) % md : power(a * a % md, b / 2, md) % md));}

//const ll md = 1e9 + 7;//998244353;
const int xn = 1e5 + 10;
const int xm = -20 + 10;
const int SQ = 320;
const int sq = 320 + 10;
const int inf = 1e9 + 10;
const ll INF = 1e18 + 10;
const int Md = 998244353;
const int TM = 3;
const int Base = 257;

int n, root = 1, col[xn], cnt, H[xn], sz[xn], a = 1, ans[xn], ans2[xn], last[xn], ted[xn];
vector <int> adj[xn];
bool mark[xn], flag;

void DFS4(int v){
	mark[v] = true;
	for (int u : adj[v])	if (!mark[u] && u != last[v])	DFS4(u);
	ans[++ cnt] = col[v];
	for (int u : adj[v])	if (!mark[u] && u == last[v])	DFS4(u);
}

void DFS3(int v){
	mark[v] = true;
	col[v] = ++ cnt;
	if (sz[v] == 1)	return;
	for (int u : adj[v])	if (!mark[u]) last[v] = u;
	for (int u : adj[v])	if (!mark[u] && sz[u] > 1)	last[v] = u;
	for (int u : adj[v])   if (!mark[u] && u != last[v])	DFS3(u);
	for (int u : adj[v])	if (!mark[u] && u == last[v])	DFS3(u);
}

void DFS2(int v){
	mark[v] = true;
	sz[v] = 1;
	ted[v] = 0;
	for (int u : adj[v]){
		if (mark[u])	continue;
		DFS2(u);
		sz[v] += sz[u];
		ted[v] += (sz[u] > 1);
	}
	flag |= (ted[v] > 1);
}

void DFS(int v){
	mark[v] = true;
	for (int u : adj[v]){
		if (mark[u])	continue;
		H[u] = H[v] + 1;
		DFS(u);
	}
}

void solve(int Root){
	flag = false;
	memset(mark, 0, sizeof mark);
	memset(sz, 0, sizeof sz);
	DFS2(Root);
	if (flag) return;
	memset(mark, 0, sizeof mark);
	cnt = 0;
	DFS3(Root);
	memset(mark, 0, sizeof mark);
	cnt = 0;
	DFS4(Root);
}

int main(){
    InTheNameOfGod;
    
    cin >> n;
    for (int i = 1; i < n; ++ i){
    	int v, u;
    	cin >> v >> u;
    	adj[v].push_back(u);
    	adj[u].push_back(v);
	}
	DFS(1);
	for (int v = 2; v <= n; ++ v)	if (H[v] > H[a])	a = v;
	memset(H, 0, sizeof H), memset(mark, false, sizeof mark);
	DFS(a);
	for (int v = 1; v <= n; ++ v)	if (H[v] > H[root])	root = v;
	solve(a);
	for (int i = 1; i <= n; ++ i)	ans2[i] = ans[i];
	memset(ans, 0, sizeof ans);
	solve(root);
	if (ans[1] == 0 && ans2[1] == 0) kill(-1);
	bool fl1 = false;
	for (int i = 1; i <= n; ++ i){
		if (ans[i] == ans2[i])	continue;
		if (ans2[i] < ans[i] && ans2[i]) fl1 = true;
		if (ans[i] == 0) fl1 = true;
		break;
	}
	if (fl1)	for (int i = 1; i <= n; ++ i)	ans[i] = ans2[i];
	for (int i = 1; i <= n; ++ i)	cout << ans[i] << sep;
	cout << endl;
	
    return 0;
}


Measured memory_bytes: 13824