using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Numerics; using System.Text; using System.Text.RegularExpressions; using System.Threading.Tasks; using static System.Math; using MethodImplAttribute = System.Runtime.CompilerServices.MethodImplAttribute; using MethodImplOptions = System.Runtime.CompilerServices.MethodImplOptions; public static class P { public static void Main() { int n = int.Parse(Console.ReadLine()); UnionFind uf = new UnionFind(n); for (int i = 0; i < n - 1; i++) { var st = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray(); uf.TryUnite(st[0], st[1]); } Console.WriteLine( uf.GroupCount == 1 || (uf.GroupCount == 2 && uf.AllRepresents.Min(x => uf.GetSize(x)) == 1) ? "Bob" : "Alice"); } } class UnionFind { public int Size { get; private set; } public int GroupCount { get; private set; } public IEnumerable AllRepresents => Parent.Where((x, y) => x == y); int[] Sizes; int[] Parent; public UnionFind(int count) { Size = count; GroupCount = count; Parent = new int[count]; Sizes = new int[count]; for (int i = 0; i < count; i++) Sizes[Parent[i] = i] = 1; } public bool TryUnite(int x, int y) { int xp = Find(x); int yp = Find(y); if (yp == xp) return false; if (Sizes[xp] < Sizes[yp]) { var tmp = xp; xp = yp; yp = tmp; } GroupCount--; Parent[yp] = xp; Sizes[xp] += Sizes[yp]; return true; } [MethodImpl(MethodImplOptions.AggressiveInlining)] public int GetSize(int x) => Sizes[Find(x)]; [MethodImpl(MethodImplOptions.AggressiveInlining)] public int Find(int x) { while (x != Parent[x]) x = (Parent[x] = Parent[Parent[x]]); return x; } }