#include <cstdio>
#include <vector>
static const int N = 4000;
int n;
std::vector<int> g[N];
int cur;
int fs[2][N * 2], f[2][N * 2];
int ans[N];
void dfs(int a, int p, int x, int y) {
y += a < cur ? -1 : 1;
f[x][n + y]++;
for (std::size_t i = 0; i < g[a].size(); i++) {
int b = g[a][i];
if (b == p)
continue;
dfs(b, a, 1 - x, y);
}
}
void solve(int a) {
cur = a;
for (int i = 0; i < 2; i++)
for (int j = 0; j < 2 * n; j++)
fs[i][j] = 0;
for (std::size_t i = 0; i < g[a].size(); i++)
{
for (int j = 0; j < 2; j++)
for (int k = 0; k < 2 * n; k++)
f[j][k] = 0;
dfs(g[a][i], a, 1, 0);
for (int j = 0; j < 2; j++)
for (int k = 0; k < 2 * n; k++)
ans[cur] += fs[j][k] * f[j][2 * n - k] * 2;
ans[cur] += f[0][n] * 2;
for (int j = 0; j < 2; j++)
for (int k = 0; k < 2 * n; k++)
fs[j][k] += f[j][k];
}
}
int main() {
freopen("input.txt", "rt", stdin);
freopen("output.txt", "wt", stdout);
scanf("%d", &n);
for (int i = 1; i < n; i++) {
int x, y;
scanf("%d%d", &x, &y);
x--, y--;
g[x].push_back(y);
g[y].push_back(x);
}
for (int i = 0; i < n; i++)
solve(i);
for (int i = 0; i < n; i++)
printf("%d\n", ans[i]);
return 0;
}
I2luY2x1ZGUgPGNzdGRpbz4KI2luY2x1ZGUgPHZlY3Rvcj4KCnN0YXRpYyBjb25zdCBpbnQgTiA9IDQwMDA7CgppbnQgbjsKc3RkOjp2ZWN0b3I8aW50PiBnW05dOwppbnQgY3VyOwppbnQgZnNbMl1bTiAqIDJdLCBmWzJdW04gKiAyXTsKaW50IGFuc1tOXTsKCnZvaWQgZGZzKGludCBhLCBpbnQgcCwgaW50IHgsIGludCB5KSB7CiAgICB5ICs9IGEgPCBjdXIgPyAtMSA6IDE7CgogICAgZlt4XVtuICsgeV0rKzsKCiAgICBmb3IgKHN0ZDo6c2l6ZV90IGkgPSAwOyBpIDwgZ1thXS5zaXplKCk7IGkrKykgewogICAgICAgIGludCBiID0gZ1thXVtpXTsKCiAgICAgICAgaWYgKGIgPT0gcCkKICAgICAgICAgICAgY29udGludWU7CgogICAgICAgIGRmcyhiLCBhLCAxIC0geCwgeSk7CiAgICB9Cn0KCnZvaWQgc29sdmUoaW50IGEpIHsKICAgIGN1ciA9IGE7CgogICAgZm9yIChpbnQgaSA9IDA7IGkgPCAyOyBpKyspCiAgICAgICAgZm9yIChpbnQgaiA9IDA7IGogPCAyICogbjsgaisrKQogICAgICAgICAgICBmc1tpXVtqXSA9IDA7CgogICAgZm9yIChzdGQ6OnNpemVfdCBpID0gMDsgaSA8IGdbYV0uc2l6ZSgpOyBpKyspCiAgICB7CiAgICAgICAgZm9yIChpbnQgaiA9IDA7IGogPCAyOyBqKyspCiAgICAgICAgICAgIGZvciAoaW50IGsgPSAwOyBrIDwgMiAqIG47IGsrKykKICAgICAgICAgICAgICAgIGZbal1ba10gPSAwOwoKICAgICAgICBkZnMoZ1thXVtpXSwgYSwgMSwgMCk7CgogICAgICAgIGZvciAoaW50IGogPSAwOyBqIDwgMjsgaisrKQogICAgICAgICAgICBmb3IgKGludCBrID0gMDsgayA8IDIgKiBuOyBrKyspCiAgICAgICAgICAgICAgICBhbnNbY3VyXSArPSBmc1tqXVtrXSAqIGZbal1bMiAqIG4gLSBrXSAqIDI7CgogICAgICAgIGFuc1tjdXJdICs9IGZbMF1bbl0gKiAyOwoKICAgICAgICBmb3IgKGludCBqID0gMDsgaiA8IDI7IGorKykKICAgICAgICAgICAgZm9yIChpbnQgayA9IDA7IGsgPCAyICogbjsgaysrKQogICAgICAgICAgICAgICAgZnNbal1ba10gKz0gZltqXVtrXTsKICAgIH0KfQoKaW50IG1haW4oKSB7CiAgICBmcmVvcGVuKCJpbnB1dC50eHQiLCAicnQiLCBzdGRpbik7CiAgICBmcmVvcGVuKCJvdXRwdXQudHh0IiwgInd0Iiwgc3Rkb3V0KTsKCiAgICBzY2FuZigiJWQiLCAmbik7CgogICAgZm9yIChpbnQgaSA9IDE7IGkgPCBuOyBpKyspIHsKICAgICAgICBpbnQgeCwgeTsKICAgICAgICBzY2FuZigiJWQlZCIsICZ4LCAmeSk7CiAgICAgICAgeC0tLCB5LS07CiAgICAgICAgZ1t4XS5wdXNoX2JhY2soeSk7CiAgICAgICAgZ1t5XS5wdXNoX2JhY2soeCk7CiAgICB9CgogICAgZm9yIChpbnQgaSA9IDA7IGkgPCBuOyBpKyspCiAgICAgICAgc29sdmUoaSk7CgogICAgZm9yIChpbnQgaSA9IDA7IGkgPCBuOyBpKyspCiAgICAgICAgcHJpbnRmKCIlZFxuIiwgYW5zW2ldKTsKCiAgICByZXR1cm4gMDsKfQo=