#3
TLE了怎么办啊/dk
#pragma GCC optimize(2)
#pragma GCC diagnostic error "-std=c++11"
#pragma GCC optimize(2)
#pragma GCC optimize(3)
#pragma GCC optimize("Ofast")
#pragma GCC optimize("inline")
#pragma GCC optimize("-fgcse")
#pragma GCC optimize("-fgcse-lm")
#pragma GCC optimize("-fipa-sra")
#pragma GCC optimize("-ftree-pre")
#pragma GCC optimize("-ftree-vrp")
#pragma GCC optimize("-fpeephole2")
#pragma GCC optimize("-ffast-math")
#pragma GCC optimize("-fsched-spec")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("-falign-jumps")
#pragma GCC optimize("-falign-loops")
#pragma GCC optimize("-falign-labels")
#pragma GCC optimize("-fdevirtualize")
#pragma GCC optimize("-fcaller-saves")
#pragma GCC optimize("-fcrossjumping")
#pragma GCC optimize("-fthread-jumps")
#pragma GCC optimize("-funroll-loops")
#pragma GCC optimize("-fwhole-program")
#pragma GCC optimize("-freorder-blocks")
#pragma GCC optimize("-fschedule-insns")
#pragma GCC optimize("inline-functions")
#pragma GCC optimize("-ftree-tail-merge")
#pragma GCC optimize("-fschedule-insns2")
#pragma GCC optimize("-fstrict-aliasing")
#pragma GCC optimize("-fstrict-overflow")
#pragma GCC optimize("-falign-functions")
#pragma GCC optimize("-fcse-skip-blocks")
#pragma GCC optimize("-fcse-follow-jumps")
#pragma GCC optimize("-fsched-interblock")
#pragma GCC optimize("-fpartial-inlining")
#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("-freorder-functions")
#pragma GCC optimize("-findirect-inlining")
#pragma GCC optimize("-fhoist-adjacent-loads")
#pragma GCC optimize("-frerun-cse-after-loop")
#pragma GCC optimize("inline-small-functions")
#pragma GCC optimize("-finline-small-functions")
#pragma GCC optimize("-ftree-switch-conversion")
#pragma GCC optimize("-foptimize-sibling-calls")
#pragma GCC optimize("-fexpensive-optimizations")
#pragma GCC optimize("-funsafe-loop-optimizations")
#pragma GCC optimize("inline-functions-called-once")
#pragma GCC optimize("-fdelete-null-pointer-checks")
#include<bits/stdc++.h>
#define For(i,a,b) for(register int i=(a);i<=(b);++i)
#define Rep(i,a,b) for(register int i=(a);i>=(b);--i)
using namespace std;
inline int read()
{
char c=getchar();int x=0;
for(;!isdigit(c);c=getchar());
for(;isdigit(c);c=getchar())x=(x<<1)+(x<<3)+(c^48);
return x;
}
#define maxn 100005
int n,m,res;
struct edge{
int to,nxt;
}e[maxn<<1];
int tot,head[maxn];
inline void adde(int u,int v){
e[++tot]=(edge){v,head[u]};
head[u]=tot;
}
bool ok[maxn];
multiset<int>s[maxn];
int dfs(int u,int pa,int k)
{
s[u].clear();
for(int i=head[u];i;i=e[i].nxt){
int v=e[i].to;
if(v==pa)continue;
int val=dfs(v,u,k)+1;
if(!val)return -1;
if(val==k)res++;
else s[u].insert(val);
}
int mx=0,no_use=0;
while(!s[u].empty())
{
if(s[u].size()==1)return *s[u].begin();
multiset<int>::iterator it=s[u].lower_bound(k-*s[u].begin());
if(it==s[u].begin() && s[u].count(*s[u].begin())==1)
mx=max(mx,*s[u].begin()),no_use++;
else if(it==s[u].end())
mx=max(mx,*s[u].begin()),no_use++;
else s[u].erase(s[u].find(*it)),res++;
s[u].erase(s[u].find(*s[u].begin()));
if(no_use>1)return -1;
}return mx;
}
bool check(int k)
{
res=0;
dfs(1,0,k);
return res==(n-1)/k;
}
int main()
{
// freopen("length.in","r",stdin);
// freopen("length.out","w",stdout);
n=read();
For(i,2,n){
int u=read(),v=read();
adde(u,v);adde(v,u);
}
int x=n-1;
For(i,1,x/i)
{
if(x%i)continue;
ok[i]=check(i);
if(i!=x/i)ok[x/i]=check(x/i);
}
ok[1]=1;
For(i,1,x)printf("%d",ok[i]);
return 0;
}