#include <bits/stdc++.h>
using namespace std;
const int N = 3000;
int n, du[N + 1], vis[N + 1];
vector<int> g[N + 1];
int dfs(int fa, int x, int &dep) {
  if (!vis[x]) return 1;
  for (int v : g[x])
    if (v != fa) {
      if (dfs(x, v, dep)) {
        ++dep;
        return 1;
      }
    }
  return 0;
}
int main() {
  scanf("%d", &n);
  for (int(i) = (1); (i) <= (n); ++(i)) {
    int x, y;
    scanf("%d%d", &x, &y);
    g[x].push_back(y);
    g[y].push_back(x);
    du[x] += 1, du[y] += 1;
  }
  queue<int> q;
  for (int(i) = (1); (i) <= (n); ++(i))
    if (du[i] == 1) q.push(i);
  while (!q.empty()) {
    int u = q.front();
    q.pop();
    vis[u] = 1;
    --du[u];
    for (int v : g[u]) {
      if (du[v] > 0) {
        --du[v];
        if (du[v] == 1) q.push(v);
      }
    }
  }
  vector<int> dis(n + 1);
  for (int(i) = (1); (i) <= (n); ++(i))
    if (vis[i]) dfs(-1, i, dis[i]);
  for (int(i) = (1); (i) <= (n - 1); ++(i)) cout << dis[i] << ' ';
  cout << dis[n] << endl;
  return 0;
}
