#-swank
(unless (member :child-sbcl *features*)
  (quit
   :unix-status
   (process-exit-code
    (run-program *runtime-pathname*
                 `("--control-stack-size" "64MB"
                   "--noinform" "--disable-ldb" "--lose-on-corruption" "--end-runtime-options"
                   "--eval" "(push :child-sbcl *features*)"
                   "--script" ,(namestring *load-pathname*))
                 :output t :error t :input t))))
;; -*- coding: utf-8 -*-
(eval-when (:compile-toplevel :load-toplevel :execute)
  (defparameter OPT
    #+swank '(optimize (speed 3) (safety 2))
    #-swank '(optimize (speed 3) (safety 0) (debug 0)))
  #+swank (ql:quickload '(:cl-debug-print :fiveam))
  #-swank (set-dispatch-macro-character #\# #\> (lambda (s c p) (declare (ignore c p)) (read s nil (values) t))))
#+swank (cl-syntax:use-syntax cl-debug-print:debug-print-syntax)
#-swank (disable-debugger) ; for CS Academy

;; BEGIN_INSERTED_CONTENTS
;;;
;;; Trie
;;;

;; ASCII code:
;; #\A: 65
;; #\a: 97
;; #\0: 48
(declaim (inline trie-char-encode))
(defun trie-char-encode (x)
  (if (char= #\0 x) 0 1))

(defconstant +trie-alphabet-size+ 2)

;; TODO: enable to set VALUE to NIL by distinguishing null and unbound.
(declaim (inline %make-trie-node))
(defstruct (trie-node (:constructor %make-trie-node
                          (&optional value
                           &aux (children (make-array #.+trie-alphabet-size+
                                                      :element-type t
                                                      :initial-element 0)))))
  (value nil)
  (children nil :type (simple-array t (#.+trie-alphabet-size+))))

(declaim (inline make-trie))
(defun make-trie () (%make-trie-node))

(declaim (inline trie-add!))
(defun trie-add! (trie-node string &optional (value t))
  "Adds STRING to the trie and assigns VALUE to it. Note that null value means
the string doesn't exist in the trie: that is, (trie-add! <trie-node> <string>
nil) virtually works as a deletion of <string>."
  (declare (vector string))
  (let ((end (length string)))
    (labels ((recur (node position)
               (if (= position end)
                   (unless (trie-node-value node)
                     (setf (trie-node-value node) value))
                   (let ((children (trie-node-children node))
                         (char (trie-char-encode (aref string position))))
                     (when (eql 0 (aref children char))
                       (setf (aref children char) (%make-trie-node)))
                     (recur (aref children char) (+ 1 position))))))
      (recur trie-node 0)
      trie-node)))

(declaim (inline trie-query))
(defun trie-query (trie-node string function &key (start 0) end)
  "Calls FUNCTION for each prefix of STRING existing in TRIE-NODE. FUNCTION
takes two arguments: the end position and the assigned value."
  (declare (vector string)
           ((integer 0 #.most-positive-fixnum) start)
           ((or null (integer 0 #.most-positive-fixnum)) end)
           (function function))
  (let ((end (or end (length string))))
    (labels ((recur (node position)
               (when (trie-node-value node)
                 (funcall function position (trie-node-value node)))
               (unless (= position end)
                 (let ((children (trie-node-children node))
                       (char (trie-char-encode (aref string position))))
                   (unless (eql 0 (aref children char))
                     (recur (aref children char) (+ 1 position)))))))
      (recur trie-node start))))

(defun trie-get (trie-node string &key (start 0) end)
  "Finds STRING in TRIE-NODE and returns the assigned value if it exists,
  otherwise NIL."
  (declare (vector string)
           ((integer 0 #.most-positive-fixnum) start)
           ((or null (integer 0 #.most-positive-fixnum)) end))
  (let ((end (or end (length string))))
    (labels ((recur (node position)
               (if (= position end)
                   (trie-node-value node)
                   (let ((children (trie-node-children node))
                         (char (trie-char-encode (aref string position))))
                     (unless (eql 0 (aref children char))
                       (recur (aref children char) (+ 1 position)))))))
      (recur trie-node start))))

(defun trie-query-longest (trie-node string &key (start 0) end)
  "Returns the end position and the value of the longest word in TRIE-NODE which
coincides with a prefix of STRING. Returns NIL when no such words exist."
  (declare (vector string)
           ((integer 0 #.most-positive-fixnum) start)
           ((or null (integer 0 #.most-positive-fixnum)) end))
  (let ((end (or end (length string)))
        result-position
        result-value)
    (declare ((or null (integer 0 #.most-positive-fixnum)) result-position))
    (labels ((recur (node position)
               (when (trie-node-value node)
                 (setq result-position position
                       result-value (trie-node-value node)))
               (unless (= position end)
                 (let ((children (trie-node-children node))
                       (char (trie-char-encode (aref string position))))
                   (unless (eql 0 (aref children char))
                     (recur (aref children char) (+ 1 position)))))))
      (recur trie-node start)
      (values result-position result-value))))


(defmacro dbg (&rest forms)
  #+swank
  (if (= (length forms) 1)
      `(format *error-output* "~A => ~A~%" ',(car forms) ,(car forms))
      `(format *error-output* "~A => ~A~%" ',forms `(,,@forms)))
  #-swank (declare (ignore forms)))

(defmacro define-int-types (&rest bits)
  `(progn
     ,@(mapcar (lambda (b) `(deftype ,(intern (format nil "UINT~A" b)) () '(unsigned-byte ,b))) bits)
     ,@(mapcar (lambda (b) `(deftype ,(intern (format nil "INT~A" b)) () '(signed-byte ,b))) bits)))
(define-int-types 2 4 7 8 15 16 31 32 62 63 64)

(declaim (inline println))
(defun println (obj &optional (stream *standard-output*))
  (let ((*read-default-float-format* 'double-float))
    (prog1 (princ obj stream) (terpri stream))))

(defconstant +mod+ 1000000007)

;; Body

(declaim (inline grundy))
(defun grundy (depth max-depth)
  (declare (uint62 depth max-depth))
  (if (= depth max-depth)
      0
      (let ((x (- max-depth depth))
            (res 1))
        (declare (uint62 x res))
        (loop while (evenp x)
              do (setf res (* res 2))
                 (setf x (floor x 2)))
        res)))

(defun main ()
  (declare #.OPT)
  (let* ((n (read))
         (l (read))
         (trie (make-trie)))
    (declare (uint62 n l))
    (dotimes (i n)
      (trie-add! trie (the simple-string (read-line))))
    (labels ((dfs (node depth)
               (declare (uint62 depth)
                        (values uint62))
               (if (eql 0 node)
                   (grundy (- depth 1) l)
                   (let ((children (trie-node-children node)))
                     (logxor (dfs (aref children 0) (+ depth 1))
                             (dfs (aref children 1) (+ depth 1)))))))
      (if (zerop (dfs trie 0))
          (write-line "Bob")
          (write-line "Alice")))))

#-swank (main)


Measured memory_bytes: 29748