#include <bits/stdc++.h>
using namespace std;
const int N = 4e5 + 1;
vector<int> ve[N];
int num[N], maxson[N], down[N], up[N];
int n;
void gmax(int& a, int b) {
  if (a < b) a = b;
}
void dfs(int x, int fa) {
  num[x] = 1;
  down[x] = maxson[x] = 0;
  for (int i = 0; i < ve[x].size(); i++) {
    int y = ve[x][i];
    if (y == fa) continue;
    dfs(y, x);
    num[x] += num[y];
    gmax(down[x], num[y] <= n / 2 ? num[y] : down[y]);
    gmax(maxson[x], num[y]);
  }
}
multiset<int>::iterator it;
void dfs2(int x, int fa) {
  multiset<int> se;
  for (int i = 0; i < ve[x].size(); i++) {
    int y = ve[x][i];
    if (y != fa) se.insert(num[y] <= n / 2 ? num[y] : down[y]);
  }
  for (int i = 0; i < ve[x].size(); i++) {
    int y = ve[x][i];
    if (y != fa) {
      if (n - num[y] <= n / 2)
        up[y] = n - num[y];
      else {
        it = se.find(num[y] <= n / 2 ? num[y] : down[y]);
        se.erase(it);
        gmax(up[y], up[x]);
        if (!se.empty()) gmax(up[y], *se.rbegin());
        se.insert(num[y] <= n / 2 ? num[y] : down[y]);
      }
      dfs2(y, x);
    }
  }
}
int main() {
  int u, v;
  scanf("%d", &n);
  for (int i = 1; i < n; i++) {
    scanf("%d%d", &u, &v);
    ve[u].push_back(v), ve[v].push_back(u);
  }
  dfs(1, -1);
  dfs2(1, -1);
  bool tag;
  for (int i = 1; i <= n; i++) {
    if (maxson[i] <= n / 2 && n - num[i] <= n / 2)
      tag = true;
    else if (n - num[i] > n / 2)
      tag = n - num[i] - up[i] <= n / 2;
    else
      tag = maxson[i] - down[i] <= n / 2;
    putchar(tag + '0');
    putchar(i == n ? '\n' : ' ');
  }
  return 0;
}
