open System open System.Collections.Generic [] module Cin = let read f = stdin.ReadLine() |> f let reada f = stdin.ReadLine().Split() |> Array.map f let readChars() = read string |> Seq.toArray let readInts() = readChars() |> Array.map (fun x -> Convert.ToInt32(x.ToString())) [] module Cout = let writer = new IO.StreamWriter(new IO.BufferedStream(Console.OpenStandardOutput())) let print (s: string) = writer.Write s let println (s: string) = writer.WriteLine s let inline puts (s: ^a) = string s |> println type UnionFind = { par: int array rank: int array } [] [] module UnionFind = let inline init (n: ^a) = let n = int n let par = Array.init n id let rank = Array.zeroCreate n { UnionFind.par = par rank = rank } let rec root x uf = let par = uf.par match x = par.[x] with | true -> x | false -> let px = par.[x] par.[x] <- root px uf par.[x] let find x y uf = (root x uf) = (root y uf) let unite x y uf = let par, rank = uf.par, uf.rank let rx, ry = root x uf, root y uf match rx = ry with | true -> false | false -> let large, small = if rank.[rx] < rank.[ry] then ry, rx else rx, ry par.[small] <- large rank.[large] <- rank.[large] + rank.[small] rank.[small] <- 0 true let main() = let n = read int let uni = UnionFind.init n for i in 0 .. n - 2 do let [| u; v |] = reada int uni |> UnionFind.unite u v |> ignore let o = uni |> UnionFind.root 0 let ok = Array.forall (fun i -> UnionFind.root i uni = o) uni.par if ok then "Bob" else "Alice" |> puts () main() writer.Close()