#include <bits/stdc++.h>
using namespace std;
const int MAXN = 400010;
typedef struct {
  int to, next;
} Edge;
Edge tree[MAXN * 2];
int head[MAXN], cnt;
int n;
bool ans[MAXN];
int centroid;
int amts[MAXN], maxSubamt[MAXN];
struct Son {
  set<int> subset;
  int id;
  int amt;
} maxSon[2];
void add(int from, int to) {
  tree[cnt].to = to;
  tree[cnt].next = head[from];
  head[from] = cnt++;
}
void init() {
  memset(head, -1, sizeof(head));
  memset(ans, 0, sizeof(ans));
  cnt = 0;
  centroid = -1;
  maxSon[0].amt = maxSon[1].amt = 0;
  maxSon[0].subset.clear();
  maxSon[1].subset.clear();
}
void find_centroid(int root, int par) {
  amts[root] = 1, maxSubamt[root] = 0;
  for (int i = head[root], to = 0; i != -1; i = tree[i].next) {
    to = tree[i].to;
    if (to != par) {
      find_centroid(to, root);
      amts[root] += amts[to];
      maxSubamt[root] = max(maxSubamt[root], amts[to]);
    }
  }
  if (max(maxSubamt[root], n - amts[root]) <= n / 2) centroid = root;
}
void recalculate_amts(int root, int par) {
  amts[root] = 1;
  for (int i = head[root], to = 0; i != -1; i = tree[i].next) {
    to = tree[i].to;
    if (to != par) {
      recalculate_amts(to, root);
      amts[root] += amts[to];
    }
  }
}
void find_max2sons(int root, int par) {
  for (int i = head[root], to = 0; i != -1; i = tree[i].next) {
    to = tree[i].to;
    if (to != par) {
      if (maxSon[0].amt < amts[to]) {
        maxSon[1] = maxSon[0];
        maxSon[0].amt = amts[to];
        maxSon[0].id = to;
      } else if (maxSon[1].amt < amts[to]) {
        maxSon[1].amt = amts[to];
        maxSon[1].id = to;
      }
    }
  }
}
void find_subset(int root, int par) {
  maxSon[0].subset.insert(root);
  for (int i = head[root], to = 0; i != -1; i = tree[i].next) {
    to = tree[i].to;
    if (to != par) {
      find_subset(to, root);
    }
  }
}
void dfs_ans(int root, int par) {
  if (root == centroid)
    ans[root] = true;
  else {
    if (maxSon[0].subset.count(root)) {
      if (n - amts[root] - maxSon[1].amt <= n / 2)
        ans[root] = true;
      else if (n - maxSon[0].amt <= n / 2)
        ans[root] = true;
    } else if (n - amts[root] - maxSon[0].amt <= n / 2)
      ans[root] = true;
  }
  for (int i = head[root], to = 0; i != -1; i = tree[i].next) {
    to = tree[i].to;
    if (to != par) {
      dfs_ans(to, root);
    }
  }
}
int main() {
  int a, b;
  while (~scanf("%d", &n)) {
    init();
    for (int i = 1; i < n; ++i) {
      scanf("%d%d", &a, &b);
      add(a, b);
      add(b, a);
    }
    find_centroid(1, -1);
    recalculate_amts(centroid, -1);
    find_max2sons(centroid, -1);
    if (centroid != -1) {
      find_subset(maxSon[0].id, centroid);
      dfs_ans(centroid, -1);
    }
    for (int i = 1; i <= n; ++i)
      printf("%d%c", ans[i] ? 1 : 0, i < n ? ' ' : '\n');
  }
  return 0;
}
