#include <bits/stdc++.h>
using namespace std;
const int maxn = 4e5 + 10, inf = 1e9 + 10, MOD = 1e9 + 7, Sq = 708;
const long long INF = 1e18 + 10;
vector<int> g[maxn];
int dp_down[maxn][2], dp_up[maxn][2], child[maxn], n, par[maxn];
void dfs1(int u, int p) {
  par[u] = p;
  for (int v : g[u])
    if (v != p) {
      dfs1(v, u);
      child[u] += child[v] + 1;
      dp_down[u][0] = max(dp_down[u][0], max(dp_down[v][0], dp_down[v][1]));
    }
  if (child[u] + 1 <= n / 2) dp_down[u][1] = child[u] + 1;
}
void dfs2(int u, int p) {
  int mx = 0;
  if (n - child[u] <= n / 2) dp_up[u][1] = n - child[u];
  if (n - child[u] - 1 <= n / 2)
    dp_up[u][0] = max(dp_up[u][0], n - child[u] - 1);
  for (int v : g[u])
    if (v != p) {
      dp_up[v][0] = max(dp_up[v][0], dp_up[u][0]);
      dp_up[v][0] = max(dp_up[v][0], mx);
      mx = max(mx, max(dp_down[v][0], dp_down[v][1]));
    }
  mx = 0;
  for (int i = g[u].size() - 1; i >= 0; i--) {
    int v = g[u][i];
    if (v != p) {
      dp_up[v][0] = max(dp_up[v][0], mx);
      mx = max(mx, max(dp_down[v][0], dp_down[v][1]));
      dfs2(v, u);
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n;
  for (int i = 0, u, v; i < n - 1; i++) {
    cin >> u >> v;
    u--, v--;
    g[u].push_back(v);
    g[v].push_back(u);
  }
  dfs1(0, 0);
  dfs2(0, 0);
  for (int i = 0; i < n; i++) {
    bool sw = false;
    if (n - child[i] - 1 - dp_up[i][0] > n / 2) sw = true;
    if (child[i] > n / 2)
      for (int v : g[i])
        if (v != par[i])
          if (child[v] + 1 > n / 2)
            if (child[v] + 1 - dp_down[v][0] > n / 2) sw = true;
    if (sw)
      cout << "0 ";
    else
      cout << "1 ";
  }
  return 0;
}
