#define _USE_MATH_DEFINES #include using namespace std; class UnionFind { private: int siz; vector a; public: UnionFind(int x) : siz(x), a(x, -1) {} int root(int x) { return a[x] < 0 ? x : a[x] = root(a[x]); } bool unite(int x, int y) { x = root(x); y = root(y); if (x == y) return false; siz--; if (a[x] > a[y]) swap(x, y); a[x] += a[y]; a[y] =x; return true; } bool same(int x, int y) { return root(x) == root(y); } int size(int x) { return -a[root(x)]; } int connected_component() { return siz; } }; const int INF = 1 << 30; bool dfs (int cur, int from, int c, const vector>& g, vector& order, vector& low) { order[cur] = c++; low[cur] = order[cur]; bool res = false; for (int nbr : g[cur]) { if (order[nbr] == INF) { res |= dfs (nbr, cur, c, g, order, low); low[cur] = min(low[cur], low[nbr]); if (low[nbr] == order[nbr]) { res = true; } } else if (nbr != from) { low[cur] = min(low[cur], low[nbr]); } } return res; } signed main() { ios::sync_with_stdio(false); cin.tie(0); int n; cin >> n; vector> g(n); UnionFind uf(n); for (int i = 0; i + 1 < n; i++) { int u, v; cin >> u >> v; g[u].push_back(v); g[v].push_back(u); uf.unite(u, v); } vector order(n, INF), low(n, INF); bool b = false; for (int i = 0; i < n; i++) { if (uf.size(i) > 1 && uf.root(i) == i) { order[i] = 0; b |= dfs (i, -1, 0, g, order, low); } } if (uf.connected_component() > 2 || (uf.connected_component() > 1 && b)) cout << "Alice\n"; else cout << "Bob\n"; return 0; }