#include #include using namespace std; using namespace atcoder; using ll = long long; struct Lowlink { const vector> g; ll N; vector ord, low; vector articulation; // 関節点 vector> bridge; // 橋 (辺(u, v)が u < v となるよう格納) Lowlink(const vector> &g): g(g), N(g.size()), ord(N, -1), low(N, -1) { for(ll i = 0, k = 0; i < N; i++) { if(ord[i] == -1) { k = dfs(i, k, -1); } } } ll dfs(ll idx, ll k, ll par) { low[idx] = (ord[idx] = k++); ll cnt = 0; bool arti = false, second = false; for(auto &to : g[idx]) { if(ord[to] == -1) { cnt++; k = dfs(to, k, idx); low[idx] = min(low[idx], low[to]); arti |= (par != -1) && (low[to] >= ord[idx]); if(ord[idx] < low[to]) { bridge.emplace_back(minmax(idx, to)); } } else if(to != par || second) { low[idx] = min(low[idx], ord[to]); } else { second = true; } } arti |= par == -1 && cnt > 1; if(arti) { articulation.emplace_back(idx); } return k; } }; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); ll N; cin >> N; dsu u(N); vector> g(N); ll c = N; for(ll i = 0; i < N - 1; i++) { ll a, b; cin >> a >> b; if(!u.same(a, b)) { u.merge(a, b); c--; } g[a].emplace_back(b); g[b].emplace_back(a); } if(c == 1) { cout << "Bob\n"; } else if(c == 2) { Lowlink L(g); cout << (L.bridge.empty() ? "Bob" : "Alice") << "\n"; } else { cout << "Alice\n"; } }