#include using namespace std; #include //using namespace atcoder; using ll = long long; using ull = unsigned long long; using i128 = __int128_t; using u128 = unsigned __int128_t; using mint = atcoder::static_modint<998244353>; const int mod = 998244353; #include mt19937_64 rng(std::chrono::steady_clock::now().time_since_epoch().count()); int dx[8] = {-1, 1, 0, 0, -1, -1, 1, 1}; int dy[8] = {0, 0, -1, 1, -1, 1, -1, 1}; template bool chmin(T& a, const T& b){ if (b < a){ a = b; return true; } else { return false; } } template bool chmax(T& a, const T& b){ if (a < b){ a = b; return true; } else { return false; } } struct Unionfind{ vector par, sz; vector w; Unionfind(int n) : par(n), sz(n, 1), w(n, 0) { iota(par.begin(), par.end(), 0); } int leader(int a){ if (par[a] == a){ return a; } int pa = par[a]; int r = leader(pa); w[a] += w[pa]; return par[a] = r; } bool same(int a, int b){ return leader(a) == leader(b); } //w[b] - w[a] == cを満たさなかったら-1, 満たすならleaderを返す。 int merge(int b, int a, ll c = 0){ ll x = weight(b) - weight(a); a = leader(a); b = leader(b); if (a == b){ if (c == x){ return a; } else { return -1; } } c -= x; if (sz[a] < sz[b]){ swap(a, b); c = -c; } sz[a] += sz[b]; par[b] = a; w[b] = c; return a; } int size(int a){ return sz[leader(a)]; } vector> groups(){ int n = par.size(); vector> result(n), filtered; for (int i = 0; i < n; i++){ int r = leader(i); result[r].push_back(i); } for (int i = 0; i < n; i++){ if (!result[i].empty()){ filtered.push_back(result[i]); } } return filtered; } ll weight(int a){ leader(a); return w[a]; } ll diff(int a, int b){ return weight(b) - weight(a); } }; void solve(){ int n; cin >> n; Unionfind uf(n); bool ok = true; vector cnt(n); for (int i = 0; i < n - 1; i++){ int u, v; cin >> u >> v; if (uf.same(u, v)){ ok = false; } uf.merge(u, v); cnt[u]++; cnt[v]++; } bool ng = true; for (int i = 0; i < n; i++){ if (!(cnt[i] == 0 || cnt[i] == 2)){ ng = false; } } int sz = uf.groups().size(); if (sz > 2){ ng = false; } cout << ((ok || ng)? "Bob" : "Alice") << '\n'; }; int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); int t = 1; while(t--){ cout << fixed << setprecision(15); solve(); } }