module mod_binary_tree
  implicit none
  type t_node
    type(t_node), pointer :: left => null(), right => null()
  end type
contains
  function newn0() result(res)
    type(t_node), pointer :: res
    res => null()
    allocate(res)
  end
end module mod_binary_tree
program prefix_free_game
  use mod_binary_tree
  implicit none
  integer :: n, m, i, j
  integer(8) :: l, x = 0
  character(100000) :: s
  type(t_node), pointer :: root, node
  root => newn0()
  read(*,*) n, l
  do i = 1, n
    read(*,*) s
    m = len_trim(s)
    node => root
    do j = 1, m
      if (s(j:j) == '0') then
        if (.not.associated(node%left)) node%left => newn0()
        node => node%left
      else
        if (.not.associated(node%right)) node%right => newn0()
        node => node%right
      end if
    end do
  end do
  call dfs(root, 0)
  write(*,'(a)') trim(merge('Bob  ', 'Alice', x == 0))
contains
  recursive subroutine dfs(node, depth)
    type(t_node), pointer, intent(in) :: node
    integer, intent(in) :: depth
    logical :: fl, fr
    fl = associated(node%left)
    fr = associated(node%right)
    if (fl) then
      if (.not.fr) call grundy(l - depth)
      call dfs(node%left, depth + 1)
    end if
    if (fr) then
      if (.not.fl) call grundy(l - depth)
      call dfs(node%right, depth + 1)
    end if
  end
  subroutine grundy(h)
    integer(8), intent(in) :: h
    integer :: i
    do i = 0, 63
      if (btest(h, i)) then
        x = xor(x, ibset(0_8, i))
        return
      end if
    end do
  end
end program prefix_free_game