#include <bits/stdc++.h>
using namespace std;
const int maxn = 400000 + 5;
struct tree {
  int v, to;
} p[2 * maxn];
int t[maxn], sons[maxn];
int dp[maxn], Tr[maxn];
int sTr[maxn];
int tot, cg, cnt;
void add(int v, int u) {
  p[tot].v = v;
  p[tot].to = t[u];
  t[u] = tot++;
}
void dfs(int fa, int v) {
  sons[v] = 1;
  for (int i = t[v]; i != -1; i = p[i].to) {
    int u = p[i].v;
    if (fa == u) continue;
    dfs(v, u);
    sons[v] += sons[u];
    dp[v] = max(dp[v], sons[u]);
  }
}
void dfs1(int fa, int v) {
  for (int i = t[v]; i != -1; i = p[i].to) {
    int u = p[i].v;
    if (fa == u) continue;
    if (v == cg) {
      sTr[cnt++] = u;
      Tr[u] = u;
    } else
      Tr[u] = Tr[v];
    dfs1(v, u);
  }
}
int main() {
  int n;
  scanf("%d", &n);
  memset(t, -1, sizeof(t));
  for (int i = 1; i < n; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    add(x, y);
    add(y, x);
  }
  dfs(1, 1);
  for (int i = 1; i < maxn; i++)
    if (max(sons[1] - sons[i], dp[i]) <= n / 2) {
      cg = i;
      break;
    }
  cnt = 0;
  dfs(cg, cg);
  dfs1(cg, cg);
  int fr = 0, sc = 0;
  int maxs = -1, sec = -1;
  for (int i = 0; i < cnt; i++) {
    int u = sTr[i];
    if (maxs < sons[u]) {
      sc = fr;
      sec = maxs;
      fr = u;
      maxs = sons[u];
    } else if (sec < sons[u]) {
      sc = u;
      sec = sons[u];
    }
  }
  for (int i = 1; i <= n; i++) {
    if (i == cg)
      printf("1");
    else if (Tr[i] == fr) {
      int temp = 0;
      if (sc != 0) temp = sons[cg] - sons[sc] - sons[i];
      temp = min(temp, sons[cg] - sons[fr]);
      if (temp > n / 2)
        printf("0");
      else
        printf("1");
    } else {
      int temp = min(sons[cg] - sons[fr] - sons[i], sons[cg] - sons[Tr[i]]);
      if (temp > n / 2)
        printf("0");
      else
        printf("1");
    }
    printf("%c", i == n ? '\n' : ' ');
  }
  return 0;
}
