#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:102400000,102400000")
using namespace std;
int S[400005], d[400005], maxsub[400005], maxfa[400005];
int N;
vector<int> G[400005];
void dfssize(int x, int fa) {
  int v;
  S[x] = 1;
  for (int i = 0; i < G[x].size(); i++) {
    v = G[x][i];
    if (v == fa) {
      continue;
    }
    dfssize(v, x);
    S[x] += S[v];
  }
}
void dfsdis(int x, int fa) {
  int v;
  for (int i = 0; i < G[x].size(); i++) {
    v = G[x][i];
    if (v == fa) {
      continue;
    }
    d[v] = d[x] + 1;
    dfsdis(v, x);
  }
}
void dfssub(int x, int fa) {
  int v;
  if (S[x] <= (N / 2)) {
    maxsub[x] = S[x];
  } else {
    maxsub[x] = 0;
  }
  for (int i = 0; i < G[x].size(); i++) {
    v = G[x][i];
    if (v == fa) {
      continue;
    }
    dfssub(v, x);
    if (maxsub[v] <= (N / 2) && (maxsub[x] < maxsub[v])) {
      maxsub[x] = maxsub[v];
    }
  }
}
void dfsfa(int x, int fa) {
  int v, maxA = 0, maxB = 0;
  if (fa == 0) {
    maxfa[x] = 0;
  } else {
    if (N - S[x] <= (N / 2)) {
      maxfa[x] = N - S[x];
    } else {
      if (maxfa[fa] > maxfa[x]) {
        maxfa[x] = maxfa[fa];
      }
    }
  }
  for (int i = 0; i < G[x].size(); i++) {
    v = G[x][i];
    if (v == fa) {
      continue;
    }
    if (maxsub[v] >= maxA) {
      maxB = maxA;
      maxA = maxsub[v];
    } else if (maxsub[v] > maxB) {
      maxB = maxsub[v];
    }
  }
  for (int i = 0; i < G[x].size(); i++) {
    v = G[x][i];
    if (v == fa) {
      continue;
    }
    if (maxsub[v] == maxA) {
      maxfa[v] = maxB;
    } else {
      maxfa[v] = maxA;
    }
    dfsfa(v, x);
  }
}
int main() {
  cin >> N;
  for (int i = 1; i <= N; i++) {
    G[i].clear();
  }
  int a, b;
  for (int i = 1; i < N; i++) {
    cin >> a >> b;
    G[a].push_back(b);
    G[b].push_back(a);
  }
  dfssize(1, 0);
  d[1] = 0;
  dfsdis(1, 0);
  dfssub(1, 0);
  memset(maxfa, 0, sizeof(maxfa));
  dfsfa(1, 0);
  bool rep;
  int size;
  int maxs;
  bool core;
  int v;
  for (int i = 1; i <= N; i++) {
    rep = false;
    core = true;
    for (int j = 0; j < G[i].size(); j++) {
      v = G[i][j];
      if (d[v] > d[i]) {
        size = S[v];
      } else {
        size = N - S[i];
      }
      if (size > (N / 2)) {
        if (rep) {
          core = false;
          break;
        }
        if (d[v] > d[i]) {
          maxs = maxsub[v];
        } else {
          maxs = maxfa[i];
        }
        if (maxs <= (N / 2) && (size - maxs <= (N / 2))) {
          rep = true;
        } else {
          core = false;
        }
      }
    }
    if (core) {
      cout << 1;
    } else {
      cout << 0;
    }
    cout << ' ';
  }
  cout << endl;
  return 0;
}
