Retina, 134 129129 122 bytes
511 bytes thanks to Martin Ender, and for inspiration of 1 more.
^. $&;S2=` [K-S] 1$& T`xL`d9d \d+.+ $* $ aaab a bbbcbb b|c ;$0¶$0 c ddd. d ...*.. b 19$*. S`; 1(1)*¶1(1)*¶((?<-2>.+¶)*(?<-1>.)*). $3O O^$`