#pragma GCC optimize("Ofast") #include using namespace std; #define INF (1e9) #define rep(i, n) for(int i = 0; i < (int)(n); i++) #define all(x) x.begin(),x.end() const long double PI = acos(-1.0L); const long long MOD = 1000000007LL; // const long long MOD = 998244353LL; typedef long long ll; typedef pair pii; typedef pair pll; template inline bool chmax(T &a, T b) { if (a < b) { a = b; return true;} return false; } template inline bool chmin(T &a, T b) { if (a > b) { a = b; return true;} return false; } ////////////////////////////////////////////////////////////////////////////////////////////////////////// struct UnionFind { vector node; UnionFind() = default; UnionFind(int x) {init(x);} void init(int x) { node.assign(x,-1); } bool merge(int x, int y) { x = root(x); y = root(y); if (x == y) return false; if (node[x] > node[y]) swap(x,y); node[x] += node[y]; node[y] = x; return true; } bool same(int x, int y) { return root(x) == root(y); } int root(int x) { if (node[x] < 0) return x; return node[x] = root(node[x]); } int size(int x) { return -node[root(x)]; } }; struct LowLink { const vector> &G; vector used; vector ord,low,articulation; vector> bridge; LowLink (const vector> &G) : G(G) {} int dfs(int v, int k, int pv) { used[v] = true; ord[v] = k++; low[v] = ord[v]; bool is_articulation = false; int cnt = 0; for (auto &nv : G[v]) { if (!used[nv]) { ++cnt; k = dfs(nv, k, v); low[v] = min(low[v],low[nv]); is_articulation |= ~pv && low[nv] >= ord[v]; if (ord[v] < low[nv]) bridge.emplace_back(minmax(v, nv)); } else if (nv != pv) { low[v] = min(low[v],ord[nv]); } } is_articulation |= pv == -1 && cnt > 1; if (is_articulation) articulation.emplace_back(v); return k; } virtual void build() { used.assign(G.size(), false); ord.assign(G.size(), 0); low.assign(G.size(), 0); int k = 0; for (int i = 0; i < G.size(); i++) { if (!used[i]) k = dfs(i, k, -1); } } }; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int N; cin >> N; UnionFind uf(N); vector> G(N); rep(i,N-1) { int u,v; cin >> u >> v; uf.merge(u,v); G[u].emplace_back(v); G[v].emplace_back(u); } set dic; rep(i,N) dic.emplace(uf.root(i)); if (dic.size() == 1) { cout << "Bob" << endl; } else if (dic.size() >= 3) { cout << "Alice" << endl; } else { bool ok = true; rep(i,N) if (uf.size(i) != 1 || uf.size(i) != N-1) ok = false; LowLink LL(G); LL.build(); if (LL.bridge.size()) ok = false; cout << (ok ? "Bob" : "Alice") << endl; } }