Placement of windows on the walls

Hello everyone
I am working on a set of 17 building typologies
the initial idea is that each apartment has two windows, one on the north facade and the other on the south facade
as I modeled, I realized that certain typologies cannot benefit from this arrangement of windows
so I’m looking if there is a possibility of building a script which goes in this direction of putting two windows in south and north as priority, and in cases where this is not possible, the script automatically puts these two windows in other directions
PS; although there are other apartments which only have one facade which faces the outside, so they will just have one window
I thank you in advance

Placement of windows on the (229.0 KB)