#include <bits/stdc++.h>
using namespace std;
const int maxn = 3001;
vector<int> v[maxn];
int n;
int ans[maxn], a[maxn], c[maxn];
int b[maxn][maxn];
void help(int x, int i) {
  ans[x]++;
  if (c[x] == 1) return;
  for (int k = 0; k < v[x].size(); k++) {
    if (b[x][v[x][k]] == -1 && v[x][k] != i) help(v[x][k], x);
  }
}
void dfs(int n) {
  int z = 0;
  for (int i = 1; i <= n; i++) {
    if (a[i] == 0 || a[i] == 2) z++;
  }
  if (z == n) return;
  for (int i = 1; i <= n; i++) {
    if (a[i] == 1) {
      a[i]--;
      ans[i]++;
      for (int j = 0; j < v[i].size(); j++) {
        if (b[i][v[i][j]] == 1) {
          b[i][v[i][j]] = -1;
          b[v[i][j]][i] = -1;
          a[v[i][j]]--;
        } else if (b[i][v[i][j]] == -1) {
          help(v[i][j], i);
        }
      }
      dfs(n);
    }
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin >> n;
  for (int i = 1; i <= n; i++) {
    int x, y;
    cin >> x >> y;
    b[x][y] = 1;
    b[y][x] = 1;
    a[x]++;
    a[y]++;
    c[x]++;
    c[y]++;
    v[x].push_back(y);
    v[y].push_back(x);
  }
  dfs(n);
  for (int i = 1; i <= n; i++) {
    cout << ans[i] << endl;
  }
  return 0;
}
