#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:102400000,102400000")
using namespace std;
const int INF = 0x3f3f3f3f;
const long long INFF = 0x3f3f;
const double pi = acos(-1.0);
const double inf = 1e18;
const double eps = 1e-4;
const long long mod = 1e9 + 7;
const unsigned long long mx = 133333331;
inline void RI(int &x) {
  char c;
  while ((c = getchar()) < '0' || c > '9')
    ;
  x = c - '0';
  while ((c = getchar()) >= '0' && c <= '9') x = (x << 3) + (x << 1) + c - '0';
}
struct Edge {
  int v, next;
} edge[400005 * 2];
int head[400005];
int num[400005];
int maxv[400005];
int tot;
int n;
int up[400005], down[400005];
void init() {
  memset(head, -1, sizeof(head));
  tot = 0;
}
void add_edge(int a, int b) {
  edge[tot] = (Edge){b, head[a]};
  head[a] = tot++;
}
void dfs1(int u, int fa) {
  num[u] = 1;
  maxv[u] = 0;
  up[u] = 0;
  down[u] = 1;
  for (int i = head[u]; i != -1; i = edge[i].next) {
    int v = edge[i].v;
    if (v == fa) continue;
    dfs1(v, u);
    num[u] += num[v];
    maxv[u] = max(maxv[u], maxv[v]);
    if (num[v] > n / 2) {
      if (num[v] - maxv[v] > n / 2) down[u] = 0;
    }
  }
  if (num[u] <= n / 2) maxv[u] = num[u];
}
void dfs2(int u, int fa, int d) {
  int cnt = 0;
  vector<int> st;
  st.push_back(0);
  for (int i = head[u]; i != -1; i = edge[i].next) {
    int v = edge[i].v;
    if (v == fa) continue;
    st.push_back(v);
    cnt++;
  }
  vector<int> pre(cnt + 5), suf(cnt + 5);
  for (int i = 1; i <= cnt; i++) pre[i] = max(pre[i - 1], maxv[st[i]]);
  for (int i = cnt; i > 0; i--) suf[i] = max(suf[i + 1], maxv[st[i]]);
  for (int i = 1; i <= cnt; i++) {
    if (n - num[st[i]] <= n / 2) {
      up[st[i]] = 1;
    } else {
      if (n - num[st[i]] - max(max(pre[i - 1], suf[i + 1]), d) <= n / 2)
        up[st[i]] = 1;
    }
  }
  for (int i = 1; i <= cnt; i++) {
    int k = d;
    k = max(max(pre[i - 1], suf[i + 1]), k);
    if (n - num[st[i]] <= n / 2) k = max(k, n - num[st[i]]);
    dfs2(st[i], u, k);
  }
}
int main() {
  while (cin >> n) {
    init();
    for (int i = 1; i < n; i++) {
      int a, b;
      scanf("%d%d", &a, &b);
      add_edge(a, b);
      add_edge(b, a);
    }
    dfs1(1, -1);
    up[1] = 1;
    dfs2(1, -1, 0);
    for (int i = 1; i <= n; i++) {
      if (up[i] && down[i])
        printf("1");
      else
        printf("0");
      if (i == n)
        printf("\n");
      else
        printf(" ");
    }
  }
  return 0;
}
