#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
#define PB push_back
#define MP make_pair
#define LL long long
#define int LL
#define FOR(i,a,b) for(int i = (a); i <= (b); i++)
#define RE(i,n) FOR(i,1,n)
#define REP(i,n) FOR(i,0,(int)(n)-1)
#define R(i,n) REP(i,n)
#define VI vector<int>
#define PII pair<int,int>
#define LD long double
#define FI first
#define SE second
#define st FI
#define nd SE
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())

#define unordered_map __fast_unordered_map
template<class Key, class Value, class Hash = std::hash<Key>>
using unordered_map = __gnu_pbds::gp_hash_table<Key, Value, Hash>;

template<class C> void mini(C &a4, C b4) { a4 = min(a4, b4); }
template<class C> void maxi(C &a4, C b4) { a4 = max(a4, b4); }

template<class TH> void _dbg(const char *sdbg, TH h){ cerr<<sdbg<<'='<<h<<endl; }
template<class TH, class... TA> void _dbg(const char *sdbg, TH h, TA... a) {
  while(*sdbg!=',')cerr<<*sdbg++;
  cerr<<'='<<h<<','; _dbg(sdbg+1, a...);
}

template<class T> ostream &operator<<(ostream& os, vector<T> V) {
  os << "["; for (auto vv : V) os << vv << ","; return os << "]";
}
template<class L, class R> ostream &operator<<(ostream &os, pair<L,R> P) {
  return os << "(" << P.st << "," << P.nd << ")";
}

#ifdef LOCAL
#define debug(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#else
#define debug(...) (__VA_ARGS__)
#define cerr if(0)cout
#endif

const int Base = 1 << 18;

int tree[Base * 2];

void PutValue(int p, int v) {
  p += Base;
  tree[p] = v;
  p /= 2;
  while (p) {
    tree[p] = min(tree[p * 2], tree[p * 2 + 1]);
    p /= 2;
  }
}

int GetFirstSmallerThan(int L, int R, int v) {
  int first_vert = 1e9;
  L += Base; R += Base;

  if (tree[L] < v) { return L - Base; }
  if (tree[R] < v) { first_vert = R; }

  while (L / 2 != R / 2) {
    if (L % 2 == 0 && tree[L + 1] < v) { mini(first_vert, L + 1); }
    if (R % 2 == 1 && tree[R - 1] < v) { mini(first_vert, R - 1); }
    L /= 2; R /= 2;
  }

  if (first_vert > 1e8)
    return -1;

  while (first_vert < Base) {
    assert(tree[first_vert] < v);
    if (tree[first_vert * 2] < v)
      first_vert *= 2;
    else
      first_vert = first_vert * 2 + 1;
  }

  return first_vert - Base;

}

const int MaxN = 2e5 + 100;

int N;
vector<int> adj[MaxN];
int preorder[MaxN], postorder[MaxN];
int cur_tm;
int answers[MaxN];
int num_seen;
vector<int> post_list;

void DfsPreorder(int v, int p) {
  post_list.PB(v);
  preorder[v] = cur_tm++;
  for (int s : adj[v])
    if (s != p)
      DfsPreorder(s, v);
  postorder[v] = cur_tm;
}

void AddVertex(int v) {
  debug("Add", v);
  PutValue(preorder[v], 1e9);
  ++num_seen;
  for (int child : adj[v]) {
    if (preorder[child] < preorder[v]) { continue; }
    PutValue(preorder[child], child);
  }
}

void DelVertex(int v) {
  debug("Del", v);
  /*for (int child : adj[v]) {
    if (preorder[child] < preorder[v]) { continue; }
    PutValue(preorder[child], 1e9);
  }*/
  --num_seen;
  //PutValue(preorder[v], v);
}

void DfsAnswer(int v, int p, int max_path) {
  debug("Dfs", v, p, max_path);
  
  answers[v] = num_seen;
  for (int s : adj[v]) {
    if (s == p) { continue; }
    const int from = preorder[s], to = postorder[s] - 1;
    vector<int> pushed;

    bool add_s = tree[preorder[s] + Base] == s;
    if (add_s) { pushed.PB(s); AddVertex(s); }

    int who_pre;
    while ((who_pre = GetFirstSmallerThan(from, to, max_path)) != -1) {
      const int who = post_list[who_pre];
      debug(from, to, who);
      pushed.PB(who);
      AddVertex(who);
    }

    DfsAnswer(s, v, max(max_path, s));

    for (int c : pushed) {
      DelVertex(c);
    }
  }
}


int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout << fixed << setprecision(11);
  cerr << fixed << setprecision(6);

  fill_n(tree, Base * 2, 1e9);
  cin >> N;
  for (int i = 0; i < N - 1; ++i) {
    int u, v;
    cin >> u >> v;
    adj[u].PB(v);
    adj[v].PB(u);
  }

  DfsPreorder(1, 1);

  for (int v : adj[1]) {
    for (int s : adj[v]) {
      if (s == 1) { continue; }
      PutValue(preorder[s], s);
    }
    num_seen = 1;

    DfsAnswer(v, 1, v);
  }

  for (int i = 2; i <= N; ++i)
    cout << answers[i] << " ";
  cout << "\n";
}



Measured memory_bytes: 48244