#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
long long POWER[65];
long long power(long long a, long long b) {
  long long ret = 1;
  while (b) {
    if (b & 1) ret *= a;
    a *= a;
    if (ret >= MOD) ret %= MOD;
    if (a >= MOD) a %= MOD;
    b >>= 1;
  }
  return ret;
}
long long inv(long long x) { return power(x, MOD - 2); }
void precompute() {
  POWER[0] = 1;
  for (int i = 1; i < 63; i++) POWER[i] = POWER[i - 1] << 1LL;
}
int tme = 0;
struct node {
  vector<int> v;
};
const int MAXN = 4e5 + 3;
struct node st[4 * MAXN];
int tin[MAXN], tout[MAXN];
vector<int> adj[MAXN];
int sub[MAXN];
bool ans[MAXN];
int rev[MAXN];
int n;
int L[MAXN], R[MAXN], G[MAXN];
void DFS2(int s, int par = -1) {
  tin[s] = ++tme;
  sub[s] = 1;
  rev[tme] = s;
  for (auto it : adj[s]) {
    if (it == par) continue;
    DFS2(it, s);
    sub[s] += sub[it];
  }
  tout[s] = tme;
  if (sub[s] <= n / 2)
    L[tin[s]] = max(L[tin[s]], sub[s]), R[tout[s]] = max(R[tout[s]], sub[s]);
}
void merge(struct node &A, struct node &B, struct node &C) {
  int c1 = 0, c2 = 0;
  while (c1 < ((int)A.v.size()) and c2 < ((int)B.v.size())) {
    if (A.v[c1] < B.v[c2])
      C.v.push_back(A.v[c1++]);
    else
      C.v.push_back(B.v[c2++]);
  }
  while (c1 < ((int)A.v.size())) C.v.push_back(A.v[c1++]);
  while (c2 < ((int)B.v.size())) C.v.push_back(B.v[c2++]);
}
void build(int node, int start, int end) {
  if (start == end) {
    st[node].v.push_back(sub[rev[start]]);
    return;
  }
  int mid = (start + end) >> 1;
  build(2 * node, start, mid);
  build(2 * node + 1, mid + 1, end);
  merge(st[2 * node], st[2 * node + 1], st[node]);
}
const int INF = 1e9;
bool query(int node, int start, int end, int qs, int qe, int limit,
           int inThis) {
  if (start > end or qe < start or qs > end) return false;
  if (start >= qs and end <= qe) {
    int lo = 0, hi = ((int)st[node].v.size()) - 1;
    while (lo <= hi) {
      int mid = lo + (hi - lo + 1) / 2;
      if (st[node].v[mid] <= limit and inThis - st[node].v[mid] <= n / 2)
        return true;
      else if (st[node].v[mid] <= limit)
        lo = mid + 1;
      else
        hi = mid - 1;
    }
    return false;
  }
  int mid = (start + end) >> 1;
  bool ret = query(2 * node, start, mid, qs, qe, limit, inThis);
  ret |= query(2 * node + 1, mid + 1, end, qs, qe, limit, inThis);
  return ret;
}
void DFS(int s, int par = -1) {
  int maxi = 0;
  int idx = -1;
  G[s] = -1;
  if (par != -1) G[s] = G[par];
  if (n - sub[s] <= n / 2) G[s] = max(G[s], n - sub[s]);
  for (auto it : adj[s]) {
    if (it == par) continue;
    DFS(it, s);
    if (sub[it] > maxi) maxi = sub[it], idx = it;
  }
  if (n - sub[s] > maxi) maxi = n - sub[s], idx = INF;
  if (maxi <= n / 2)
    ans[s] = 1;
  else {
    bool p = true;
    if (idx == INF) {
      int v = max(R[tin[s] - 1], L[tout[s] + 1]);
      v = max(v, G[s]);
      if (maxi - v <= n / 2)
        p = true;
      else
        p = false;
    } else if (idx != -1) {
      p = query(1, 1, n, tin[idx], tout[idx], n / 2, maxi);
    }
    ans[s] = p;
  }
}
int main() {
  precompute();
  scanf("%d", &n);
  for (int i = 1; i < n; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    adj[x].push_back(y);
    adj[y].push_back(x);
  }
  DFS2(1);
  for (int i = 2; i <= n; i++) R[i] = max(R[i], R[i - 1]);
  for (int i = n - 1; i >= 1; i--) L[i] = max(L[i], L[i + 1]);
  build(1, 1, n);
  DFS(1);
  for (int i = 1; i <= n; i++) {
    if (i != 1) printf(" ");
    if (ans[i])
      printf("1");
    else
      printf("0");
  }
  return 0;
}
