Deakstadieđáhus: The hidden mathematical logic of stories