use std::io::*; fn dfs( g: &Vec>, used: &mut [bool], ord: &mut [usize], low: &mut [usize], cnt: &mut usize, v: usize, p: usize, k: &mut usize, ) -> usize { used[v] = true; ord[v] = *k; low[v] = *k; *k += 1; for &nv in g[v].iter() { if !used[nv] { *k = dfs(&g, used, ord, low, cnt, nv, v, k); low[v] = std::cmp::min(low[v], low[nv]); if ord[v] < low[nv] { *cnt += 1; } } else if nv != p { low[v] = std::cmp::min(low[v], ord[nv]) } } *k } fn main() { let mut s: String = String::new(); std::io::stdin().read_to_string(&mut s).ok(); let mut itr = s.trim().split_whitespace(); let n: usize = itr.next().unwrap().parse().unwrap(); let mut g = vec![Vec::new(); n]; for _ in 0..n - 1 { let a: usize = itr.next().unwrap().parse().unwrap(); let b: usize = itr.next().unwrap().parse().unwrap(); g[a].push(b); g[b].push(a); } let mut con = 0; let mut cnt = 0; let mut k = 0; let mut used = vec![false; n]; let mut ord = vec![0; n]; let mut low = vec![0; n]; for i in 0..n { if !used[i] { con += 1; k = dfs(&g, &mut used, &mut ord, &mut low, &mut cnt, i, 0, &mut k); } } if con >= 3 || (con == 2 && cnt > 0) { println!("Alice",); } else { println!("Bob",) } }