#pragma GCC optimize("O2,Ofast,inline,unroll-all-loops,-ffast-math")
#pragma GCC target("popcnt")
#include <bits/stdc++.h>
#define maxn 200010
#define ll long long
#define ull unsigned long long
#define ld long double
#define fi first
#define se second
#define pb push_back
#define pob pop_back
#define pf push_front
#define pof pop_front
#define pii pair<int, int>
#define pil pair<int, ll>
#define pll pair<ll, ll>
#define IL inline
#define ss system
using namespace std;

int mx[maxn], c[maxn], n;
vector<int> nxt[maxn];
map<int, int> F[maxn];
template <class T> void read (T &x) {
  char ch = x = 0;
  bool fl = false;
  while (!isdigit(ch))
    fl |= ch == '-', ch = getchar();
  while (isdigit(ch))
    x = x * 10 + ch - '0', ch = getchar();
  x = fl ? -x : x;
}
int f(int x, int y, int fa) {
  if (F[x].count(y))
    return F[x][y];
  int ret = 0;
  for (auto &v : nxt[x]) {
    if (v != fa && v <= y)
      ret += 1 + f(v, y, x);
  }
  return F[x][y] = ret;
}
void dfs(int x, int fa) {
  mx[x] = max(mx[fa], fa);
  if (x > mx[fa])
    c[x] = c[fa] + f(x, mx[x], fa) + 1;
  else
    c[x] = c[fa] + f(x, mx[x], fa) - f(x, mx[fa], fa);
  for (auto &v : nxt[x]) {
    if (v != fa)
      dfs(v, x);
  }
}
int main() {
  read(n);
  for (int i = 1, u, v; i <= n - 1; i++) {
    read(u), read(v), nxt[u].pb(v), nxt[v].pb(u);
  }
  for (auto &v : nxt[1]) {
    dfs(v, 1);
  }
  for (int i = 2; i <= n; i++) {
    printf("%d%c", c[i], i == n ? '\n' : ' ');
  }
  return 0;
}