#include <bits/stdc++.h>
using namespace std;
vector<int> e[400005];
int n;
int maxd[400005], sum[400005], hev[400005], hevsize[400005], maxu[400005];
void dfs1(int u, int fa) {
  sum[u] = 1;
  for (int i = 0; i < e[u].size(); i++) {
    int v = e[u][i];
    if (v != fa) {
      dfs1(v, u);
      sum[u] += sum[v];
      if (sum[v] <= n / 2)
        maxd[u] = max(maxd[u], sum[v]);
      else
        maxd[u] = max(maxd[u], maxd[v]);
      if (sum[v] > hevsize[u]) {
        hevsize[u] = sum[v];
        hev[u] = v;
      }
    }
  }
  return;
}
void dfs2(int u, int fa) {
  multiset<int> s;
  for (int i = 0; i < e[u].size(); i++) {
    int v = e[u][i];
    if (v != fa) {
      if (sum[v] <= n / 2)
        s.insert(sum[v]);
      else
        s.insert(maxd[v]);
    }
  }
  for (int i = 0; i < e[u].size(); i++) {
    int v = e[u][i];
    if (v != fa) {
      if (n - sum[v] <= n / 2)
        maxu[v] = n - sum[v];
      else {
        maxu[v] = max(maxu[v], maxu[u]);
        s.erase(s.find(sum[v]));
        if (!s.empty()) {
          maxu[v] = max(*s.rbegin(), maxu[v]);
        }
        s.insert(sum[v]);
      }
      dfs2(v, u);
    }
  }
  return;
}
int main() {
  int u, v;
  scanf("%d", &n);
  for (int i = 1; i <= n - 1; i++) {
    scanf("%d%d", &u, &v);
    e[u].push_back(v);
    e[v].push_back(u);
  }
  memset(maxu, 0, sizeof(maxu));
  memset(maxd, 0, sizeof(maxd));
  dfs1(1, -1);
  dfs2(1, -1);
  for (int i = 1; i <= n; i++) {
    bool flag = true;
    if (n - sum[i] > n / 2 && n - sum[i] - maxu[i] > n / 2) flag = false;
    if (sum[hev[i]] - maxd[hev[i]] > n / 2) flag = false;
    if (i == 1)
      cout << flag;
    else
      cout << " " << flag;
  }
  return 0;
}
