#include <bits/stdc++.h>
using namespace std;
const int N = 4e5 + 10;
vector<int> tree[N];
int cnt[N];
int n, mx1, mx2;
bool centr[N], ans[N];
int dfs(int v, int p = -1) {
  int u;
  cnt[v] = 1;
  for (int i = 0; i < tree[v].size(); i++) {
    u = tree[v][i];
    if (u == p) continue;
    cnt[v] += dfs(u, v);
  }
  return cnt[v];
}
void find_centr(int v, int p = -1) {
  int u;
  bool ok = (n - cnt[v]) <= n / 2;
  for (int i = 0; i < tree[v].size(); i++) {
    u = tree[v][i];
    if (u == p) continue;
    find_centr(u, v);
    if (cnt[u] > n / 2) ok = false;
  }
  if (ok) centr[v] = 1;
  return;
}
void calc(int v, int p = -1, int mxC = -1) {
  int u;
  if (n - cnt[v] - mxC <= n / 2)
    ans[v] = true;
  else
    return;
  for (int i = 0; i < tree[v].size(); i++) {
    u = tree[v][i];
    if (u == p) continue;
    calc(u, v, mxC);
  }
  return;
}
void solveC(int aim) {
  for (int i = 1; i <= n; i++) cnt[i] = 0;
  dfs(aim);
  mx1 = -1, mx2 = -1;
  int u = 0;
  for (int i = 0; i < tree[aim].size(); i++) {
    u = tree[aim][i];
    if (cnt[u] > mx1) {
      mx2 = mx1;
      mx1 = cnt[u];
    } else if (cnt[u] > mx2)
      mx2 = cnt[u];
  }
  for (int i = 0; i < tree[aim].size(); i++) {
    u = tree[aim][i];
    if (cnt[u] == mx1 && (cnt[u] != n / 2 || n % 2))
      calc(u, aim, mx2);
    else
      calc(u, aim, mx1);
  }
}
void solve() {
  cin >> n;
  int b, e;
  for (int i = 0; i < n - 1; i++) {
    scanf("%d %d\n", &b, &e);
    tree[b].push_back(e);
    tree[e].push_back(b);
  }
  dfs(1);
  find_centr(1);
  for (int i = 1; i <= n; i++) {
    if (centr[i]) solveC(i);
  }
  for (int i = 1; i <= n; i++)
    if (centr[i] || ans[i])
      printf("1 ");
    else
      printf("0 ");
}
int main() {
  solve();
  return 0;
}
