Changed code to work with n-tuples.

Note that if are using 3-tuples, and you ask for a sentence of length 1,
it'll give you two words (because that state is 3 words long). I should
fix that, probably.

Also refactored dfs, but it's still huge and not great.