#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>
#include <iostream>
#include <sstream>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <numeric>
#include <algorithm>
#include <bitset>
#include <complex>
#include <array>
#include <list>
#include <stack>
#include <valarray>

using namespace std;

typedef unsigned uint;
typedef long long Int;
typedef unsigned long long UInt;

const int INF = 1001001001;
const Int INFLL = 1001001001001001001LL;

template<typename T> void pv(T a, T b) { for (T i = a; i != b; ++i) cout << *i << " "; cout << endl; }
template<typename T> void chmin(T& a, T b) { if (a > b) a = b; }
template<typename T> void chmax(T& a, T b) { if (a < b) a = b; }
int in() { int x; scanf("%d", &x); return x; }
double fin() { double x; scanf("%lf", &x); return x; }
Int lin() { Int x; scanf("%lld", &x); return x; }

int UF[200050], UFSZ[200050];
void init(int n) {
  for (int i = 0; i < n; ++i) {
    UF[i] = i;
    UFSZ[i] = 1;
  }
}
int find(int x) {
  return UF[x] == x ? x : UF[x] = find(UF[x]);
}
void unite(int x, int y) {
  x = find(x);
  y = find(y);
  if (x == y) {
    return;
  }

  if (UFSZ[x] > UFSZ[y]) {
    swap(x, y);
  }
  UFSZ[y] += UFSZ[x];
  UF[x] = y;
}

struct edge {
  int src, dst;
  edge(int s, int d) : src(s), dst(d) { }
};
typedef vector<edge> edges;
typedef vector<edges> graph;

int MX[200050], PAR[200050];
void dfs_mx(const graph& g, int u, int mx = 0, int p = -1) {
  MX[u] = mx;
  PAR[u] = p;
  for (const edge& e : g[u]) {
    if (e.dst == p) {
      continue;
    }
    dfs_mx(g, e.dst, max(mx, u), u);
  }
}

map<pair<int, int>, int> SUBC;
vector<int> cals[200050];
int SUB[200050], ANS[200050];

void dfs_ans(const graph& g, int u, int sm = 0) {
  if (u == 0) {
    for (const edge& e : g[u]) {
      dfs_ans(g, e.dst, 0);
    }
    return;
  }

  if (MX[u] < u) {
    ANS[u] = sm + SUB[u];
    for (const edge& e : g[u]) {
      if (e.dst == PAR[u]) {
        continue;
      }
      auto p = make_pair(u, e.dst);
      int d = (SUBC.count(p) > 0 ? SUBC[p] : 0);
      dfs_ans(g, e.dst, ANS[u] - d);
    }
    return;
  }

  ANS[u] = sm;
  if (MX[PAR[u]] < MX[u]) {
    ANS[u] += SUB[u];
  }

  for (const edge& e : g[u]) {
    if (e.dst == PAR[u]) {
      continue;
    }
    dfs_ans(g, e.dst, ANS[u]);
  }
}

int main() {
  int N = in();
  graph G(N);
  for (int i = 0; i < N - 1; ++i) {
    int a = in() - 1;
    int b = in() - 1;
    G[a].emplace_back(a, b);
    G[b].emplace_back(b, a);
  }

  dfs_mx(G, 0);
  for (int i = 1; i < N; ++i) {
    cals[MX[i]].push_back(i);
  }

  init(N);
  fill(SUB, SUB + N, 0);
  for (int i = 1; i < N; ++i) {
    for (const int u : cals[i]) {
      if (u >= i) {
        SUB[u] = 1;
        for (const edge& e : G[u]) {
          if (e.dst == PAR[u] || e.dst >= i) {
            continue;
          }
          // if(u==7)cerr<<e.dst<<' '<<UFSZ[find(e.dst)]<<endl;
          SUBC[make_pair(u, e.dst)] = UFSZ[find(e.dst)];
          SUB[u] += UFSZ[find(e.dst)];
        }
      } else {
        SUB[u] = UFSZ[find(u)];
      }
    }
    for (const edge& e : G[i]) {
      if (e.dst >= 1 && e.dst < i) {
        unite(i, e.dst);
      }
    }
  }
  // pv(SUB, SUB+N);

  dfs_ans(G, 0);
  for (int i = 1; i < N; ++i) {
    printf("%d%c", ANS[i] + 1, i + 1 == N ? '\n' : ' ');
  }

  return 0;
}


Measured memory_bytes: 38392