#include<bits/stdc++.h>
using namespace std;

#define rep(i,l,r) for(register int i = l ; i <= r ; i++)
#define repd(i,r,l) for(register int i = r ; i >= l ; i--)
#define rvc(i,S) for(register int i = 0 ; i < (int)S.size() ; i++)
#define rvcd(i,S) for(register int i = ((int)S.size()) - 1 ; i >= 0 ; i--)
#define fore(i,x)for (register int i = head[x] ; i ; i = e[i].next)
#define forup(i,l,r) for (register int i = l ; i <= r ; i += lowbit(i))
#define fordown(i,id) for (register int i = id ; i ; i -= lowbit(i))
#define pb push_back
#define prev prev_
#define stack stack_
#define mp make_pair
#define fi first
#define se second
#define lowbit(x) (x&(-x))

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int,int> pr;

const ld inf = 2e18;
const int N = 3e6 + 10;
const int maxn = 300020;
const ll mod = 1e9 + 7;
const ull base = 907;

struct node{
	int next,to;
};

inline ull power(ull x,ull y){
	ull res = 1;
	while ( y ){
		if ( y & 1 ) res = res * x;
		x = x * x;
		y >>= 1;
	}
	return res;
}
struct Hash{
	int len;
	ull val;

	Hash() { len = 0 , val = 0; }
	Hash(char c) : len(1) , val(c){};
	Hash(int l,ull v) : len(l) , val(v){};
};

bool operator < (const Hash &a,const Hash &b){
	return a.val < b.val;
}
Hash operator + (const Hash &a,const Hash &b){
	return Hash(a.len + b.len,a.val * power(base,b.len) + b.val);
}
void operator += (Hash &a,const Hash &b){ a = a + b; }

int n,p[maxn];
ull hash1,hash2;

node e[maxn * 2];
int head[maxn],cnt;	
int deg[maxn],dth[maxn],fa[maxn];
int a[maxn],tot,ans[maxn];

namespace get{	
	int sz[maxn],f[maxn],rt,mx;
	Hash q[maxn],h[maxn];
	
	void findrt(int x,int fa){
		sz[x] = 1 , f[x] = 0;
		fore(i,x){
			if ( e[i].to == fa ) continue;
			findrt(e[i].to,x);
			sz[x] += sz[e[i].to];
			if ( f[x] < sz[e[i].to] ) f[x] = sz[e[i].to];
		}
		f[x] = max(f[x],n - sz[x]);
		mx = min(mx,f[x]);
	}
	void dfs(int x,int fa){
		Hash res;
		int t = 0;
		fore(i,x){
			if ( e[i].to == fa ) continue;
			dfs(e[i].to,x);
		}
		fore(i,x) if ( e[i].to != fa ) q[t++] = h[e[i].to];
		sort(q,q + t);
		rep(i,0,t - 1) res += q[i];
		h[x] = '(' + res + ')';
	}
	ull solve(){ //无根树，以重心为根。
		mx = n;
		findrt(1,0);
		Hash res;
		rep(i,1,n) if ( f[i] == mx ){
			dfs(i,0); //两个重心选取hash最大的一个
			if ( res < h[i] ) res = h[i];
		}
		return res.val;
	}
}
void clear(){
	rep(i,1,n) head[i] = 0;
	cnt = 0;
}
void adde(int x,int y){
	e[++cnt].to = y;
	e[cnt].next = head[x];
	head[x] = cnt;
}
void init(){
	rep(i,1,n - 1){
		int x,y;
		scanf("%d %d",&x,&y);
		deg[x]++ , deg[y]++ , adde(x,y),adde(y,x);
	}
	hash1 = get::solve();
}

void finddia(int x){
	fore(i,x){
		if ( e[i].to == fa[x] ) continue;
		fa[e[i].to] = x , dth[e[i].to] = dth[x] + 1;
		finddia(e[i].to);
	}	
}
bool check(){
	ull curh = get::solve();
//	cout<<curh<<" "<<hash1<<endl;
	return curh == hash1;
}
bool cmp(int a[],int b[]){
	if ( !a[1] ) return 1;
	rep(i,1,n) if ( a[i] != b[i] ) return a[i] > b[i];
	return 0;
}	
void solve(){
	finddia(1);
	int id = 0;
	rep(i,1,n) if ( dth[id] < dth[i] ) id = i;
	dth[id] = 1 , fa[id] = 0 , finddia(id);
	rep(i,1,n) if ( dth[id] < dth[i] ) id = i;
	while ( id ) a[++tot] = id , id = fa[id];
	int last = n,tt = n,tag = 0;
	clear();
//	rep(i,1,tot) cout<<a[i]<<" ";
//	cout<<endl;
	rep(i,1,tot){
		int x = a[i];
		int curid = last - deg[x] + 1;
		if ( tag && curid == last ) curid --;
		p[tt--] = curid;
		if ( last != curid ) adde(curid,last) , adde(last,curid);
		repd(j,last - 1,curid + 1) p[tt--] = j , adde(curid,j), adde(j,curid);
		last = curid , tag = 1;
	}
//	rep(i,1,n) cout<<p[i]<<" ";
//	cout<<endl;
	if ( check() ){
		rep(i,1,n) ans[i] = p[i];
	}
	last = n,tt = n , tag = 0;
	clear();
	repd(i,tot,1){
		int x = a[i];
		int curid = last - deg[x] + 1;
		if ( tag && curid == last ) curid --;
		p[tt--] = curid;
		if ( last != curid ) adde(curid,last) , adde(last,curid);
		repd(j,last - 1,curid + 1) p[tt--] = j , adde(curid,j), adde(j,curid);
		last = curid , tag = 1;
	}
//		rep(i,1,n) cout<<p[i]<<" ";
//	cout<<endl;
	if ( check() ){
		if ( cmp(ans,p) ) rep(i,1,n) ans[i] = p[i];
	}
	if ( ans[1] ){
		rep(i,1,n) printf("%d ",ans[i]);
		puts("");
	}
	else puts("-1");
}
int main(){
//	freopen("input.txt","r",stdin);
	scanf("%d",&n);
	init();
	solve();
}


Measured memory_bytes: 28032