#include <bits/stdc++.h>
using namespace std;
const int N = 400400;
void DFS1(int i = 1, int p = 0);
void DFS2(int i = 1, int p = 0, int LastMax = 0);
void max_self(int& x, int y) { x = max(x, y); }
int n;
int W[N];
int Res[N];
int Ans[N];
vector<int> Adj[N];
vector<int> Pref[N];
vector<int> Suff[N];
int main() {
  cin >> n;
  for (int i = 1; i < n; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    Adj[x].push_back(y);
    Adj[y].push_back(x);
  }
  DFS1();
  DFS2();
  for (int i = 1; i <= n; i++) printf("%d ", Ans[i]);
}
void DFS1(int i, int p) {
  W[i] = 1;
  for (auto j : Adj[i])
    if (j != p) {
      DFS1(j, i);
      W[i] += W[j];
      max_self(Res[i], Res[j]);
    }
  if (W[i] <= n / 2) Res[i] = W[i];
  Pref[i].resize(Adj[i].size());
  Suff[i].resize(Adj[i].size());
  for (int j = 0; j < Adj[i].size(); j++) {
    if (Adj[i][j] != p) Pref[i][j] = Res[Adj[i][j]];
    if (j > 0) max_self(Pref[i][j], Pref[i][j - 1]);
  }
  for (int j = Adj[i].size() - 1; j >= 0; j--) {
    if (Adj[i][j] != p) Suff[i][j] = Res[Adj[i][j]];
    if (j + 1 < Adj[i].size()) max_self(Suff[i][j], Suff[i][j + 1]);
  }
}
void DFS2(int i, int p, int LastMax) {
  int HChild = p;
  int MaxSize = n - W[i];
  for (auto j : Adj[i])
    if (j != p)
      if (W[j] > MaxSize) MaxSize = W[j], HChild = j;
  if (HChild == p)
    Ans[i] = (MaxSize - LastMax <= n / 2);
  else
    Ans[i] = (MaxSize - Res[HChild] <= n / 2);
  for (int j = 0, k; j < Adj[i].size(); j++)
    if ((k = Adj[i][j]) != p) {
      if (n - W[k] <= n / 2)
        DFS2(k, i, n - W[k]);
      else
        DFS2(k, i,
             max(LastMax, max(j > 0 ? Pref[i][j - 1] : 0,
                              j + 1 < Adj[i].size() ? Suff[i][j + 1] : 0)));
    }
}
