LING572 Hw6: Beam search