#include <bits/stdc++.h>
using namespace std;
#pragma comment(linker, "/uACK:1024000000,1024000000")
const int inf = (int)1e9;
const int nn = 400400;
vector<int> g[nn];
int ans[nn], siz[nn], n;
int submax[nn], max1[nn], max2[nn];
void dfs(int u, int fa) {
  int sz = g[u].size();
  siz[u] = 1;
  submax[u] = 0;
  for (int i = 0; i < sz; i++) {
    int v = g[u][i];
    if (v == fa) continue;
    dfs(v, u);
    siz[u] += siz[v];
    if (submax[v] > submax[u]) {
      max2[u] = max1[u];
      max1[u] = v;
      submax[u] = submax[v];
    } else if (submax[v] > submax[max2[u]])
      max2[u] = v;
  }
  if (siz[u] <= n / 2) submax[u] = siz[u];
}
void get_ans(int u, int fa, int cnt) {
  int sz = g[u].size();
  int fuck = 1;
  for (int i = 0; i < sz; i++) {
    int v = g[u][i];
    if (v == fa) {
      int tmp = n - siz[u];
      if (tmp > n / 2 && tmp - cnt > n / 2) fuck = 0;
      continue;
    }
    if (siz[v] > n / 2) {
      if (siz[v] - submax[v] > n / 2) fuck = 0;
    }
  }
  ans[u] = fuck;
  for (int i = 0; i < sz; i++) {
    int v = g[u][i];
    if (v == fa) continue;
    int tmp;
    if (n - siz[v] <= n / 2)
      tmp = n - siz[v];
    else if (max1[u] == v)
      tmp = max(cnt, submax[max2[u]]);
    else
      tmp = max(cnt, submax[max1[u]]);
    get_ans(v, u, tmp);
  }
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i < n; i++) {
    int u, v;
    scanf("%d%d", &u, &v);
    g[u].push_back(v);
    g[v].push_back(u);
  }
  dfs(1, 0);
  get_ans(1, 0, 0);
  for (int i = 1; i <= n; i++) printf("%d ", ans[i]);
  puts("");
  return 0;
}
