#include #define REP(i,n) for(int i=0,i##_len=int(n);i Parent,es; vector diff_weight; public: UnionFind(int N){ es.resize(N,0); Parent.resize(N,-1); diff_weight.resize(N,0LL); } int root(int A){ if(Parent[A]<0) return A; else{ int r = root(Parent[A]); diff_weight[A] += diff_weight[Parent[A]]; // 累積和をとる return Parent[A]=r; } } bool issame(int A,int B){ return root(A)==root(B); } ll weight(int x) { root(x); // 経路圧縮 return diff_weight[x]; } ll diff(int x, int y) { return weight(y) - weight(x); } int size(int A){ return -Parent[root(A)]; } int eize(int A){ return es[root(A)]; } bool connect(int A,int B){ A=root(A); B=root(B); if(A==B) return false; if(size(A)>N; UnionFind uni(N); vector> graph(N); REP(i,N-1){ int a,b;cin>>a>>b; uni.connect(a,b); graph[a].push_back(b); graph[b].push_back(a); } int ans=0,u=0; REP(i,N) if(!uni.issame(0,i)) ans++,u=i; if(ans==0) cout<<"Bob"<