I can't say precisely. I don't think anyone really knows how a story takes shape. When it's done you try to explain how it happened, but every effort, at least in my case, is insufficient. There is a before, made up of fragments of memory, and an after, when the story begins. But before and after, I have to admit, are useful only in answering your question now in an intelligible way.