#include <bits/stdc++.h>
const int inf = 1e9 + 7;
const int mod = 1e9 + 7;
const int MAX_N = 1e6 + 7;
using namespace std;
struct edge {
  int to;
  int next;
} es[MAX_N << 1];
int head[MAX_N];
int cnt;
int size0[MAX_N], size[MAX_N];
int isG[MAX_N];
int N, G, fir, sec;
void add(int from, int to) {
  es[++cnt] = {to, head[from]};
  head[from] = cnt;
}
void dfs1(int v, int par) {
  size[v] = 1;
  for (int i = head[v]; i; i = es[i].next) {
    int dv = es[i].to;
    if (dv == par) continue;
    dfs1(dv, v);
    size[v] += size[dv];
  }
  if (par == G) {
    if (size[v] > size[sec]) sec = v;
    if (size[sec] > size[fir]) swap(fir, sec);
  }
}
void dfs2(int v, int par, int flag) {
  if (!flag && N - size[v] - size[fir] <= N / 2) isG[v] = 1;
  if (flag && N - size[v] - size[sec] <= N / 2) isG[v] = 1;
  for (int i = head[v]; i; i = es[i].next) {
    int dv = es[i].to;
    if (dv == par) continue;
    if (dv == fir)
      dfs2(dv, v, 1);
    else
      dfs2(dv, v, flag);
  }
}
void dfs0(int v, int par) {
  size0[v] = 1;
  int flag = 1;
  for (int i = head[v]; i; i = es[i].next) {
    int dv = es[i].to;
    if (dv == par) continue;
    dfs0(dv, v);
    size0[v] += size0[dv];
    if (size0[dv] > N / 2) flag = 0;
  }
  if (flag && N - size0[v] <= N / 2) {
    G = v;
    fir = sec = 0;
    dfs1(G, -1);
    dfs2(G, -1, 0);
  }
}
int main() {
  cin >> N;
  for (int i = 1; i <= N - 1; i++) {
    int x, y;
    cin >> x >> y;
    add(x, y);
    add(y, x);
  }
  dfs0(1, -1);
  for (int i = 1; i <= N; i++) {
    cout << isG[i] << ' ';
  }
}
