Problem:
Score : 1100 points

Problem Statement

There is a tree with N vertices numbered 1, 2, ..., N.
The edges of the tree are denoted by (x_i, y_i).

On this tree, Alice and Bob play a game against each other.
Starting from Alice, they alternately perform the following operation:

Select an existing edge and remove it from the tree, disconnecting it into two separate connected components. Then, remove the component that does not contain Vertex 1.

A player loses the game when he/she is unable to perform the operation.
Determine the winner of the game assuming that both players play optimally.

Constraints

2 \leq N \leq 100000

1 \leq x_i, y_i \leq N

The given graph is a tree.

Input

Input is given from Standard Input in the following format:

N
x_1 y_1
x_2 y_2
:
x_{N-1} y_{N-1}

Output

Print Alice if Alice wins; print Bob if Bob wins.

Sample Input 1

5
1 2
2 3
2 4
4 5

Sample Output 1

Alice

If Alice first removes the edge connecting Vertices 1 and 2, the tree becomes a single vertex tree containing only Vertex 1.
Since there is no edge anymore, Bob cannot perform the operation and Alice wins.

Sample Input 2

5
1 2
2 3
1 4
4 5

Sample Output 2

Bob

Sample Input 3

6
1 2
2 4
5 1
6 3
3 2

Sample Output 3

Alice

Sample Input 4

7
1 2
3 7
4 6
2 3
2 4
1 5

Sample Output 4

Bob

Solution in Go (1.6) (judge verdict: Wrong Answer)

package main

import (
  "bufio"
  "os"
  "strconv"
  "strings"
  "fmt"
)

var reader = bufio.NewReaderSize(os.Stdin, 1000000)
var writer = bufio.NewWriter(os.Stdout)
func NextLine() string {
  buffer := make([]byte, 0)
  for true {
    line, isPrefix, err := reader.ReadLine()
    if err != nil { panic(err) }
    buffer = append(buffer, line...)
    if !isPrefix { break }
  }
  return string(buffer)
}
func NextInt() int {
  n, _ := strconv.Atoi(NextLine())
  return n
}
func NextIntVec() []int {
  L := strings.Split(NextLine(), " ")
  N := make([]int, len(L))
  for i := range N {
    N[i], _ = strconv.Atoi(L[i])
  }
  return N
}
func NextFloat() float64 {
  n, _ := strconv.ParseFloat(NextLine(), 64)
  return n
}
func NextFloatVec() []float64 {
  L := strings.Split(NextLine(), " ")
  N := make([]float64, len(L))
  for i := range N {
    N[i], _ = strconv.ParseFloat(L[i], 64)
  }
  return N
}
func Write(s interface{}) {
  fmt.Fprintln(writer, s)
}
func WriteIntVec(A []int) {
  S := make([]string, len(A))
  for i, a := range A {
    S[i] = strconv.Itoa(a)
  }
  Write(strings.Join(S, " "))
}
func Output() {
  _ = writer.Flush()
}

func MinInt(A ...int) int {
  min := A[0]
  for _, a := range A {
    if a < min { min = a }
  }
  return min
}
func SumInt(A ...int) int {
  sum := 0
  for _, a := range A {
    sum += a
  }
  return sum
}

func Grundy (T *[][]int, P *[]int, r int) int {
  G := 0
  switch len((*T)[r]) {
  case 1:
  case 2:
    for _, adj := range (*T)[r] {
      if adj == (*P)[r] { continue }
      G = Grundy(T, P, adj) + 1
    }
  default:
    for _, adj := range (*T)[r] {
      if adj == (*P)[r] { continue }
      G = G ^ Grundy(T, P, adj)
    }
  }
  return G
}

func Solve() {
  N := NextInt()
  T := make([][]int, N)
  for i := range T {
    T[i] = make([]int, 0)
  }
  for i := 1; i < N; i++ {
    XY := NextIntVec()
    x, y := XY[0] - 1, XY[1] - 1
    T[x] = append(T[x], y)
    T[y] = append(T[y], x)
  }
  P := make([]int, N)
  for i := range P {
    P[i] = -1
  }
  P[0] = N
  Q := make([]int, N)
  pos := 1
  for _, q := range Q {
    for _, adj := range T[q] {
      if 0 <= P[adj] { continue }
      P[adj] = q
      Q[pos] = adj
      pos++
    }
  }
  T[0] = append(T[0], N)
  ans := "Alice"
  if Grundy(&T, &P, 0) == 0 { ans = "Bob" }
  Write(ans)
  return
}

func main() {
  Solve()
  Output()
}