Separating determined edges for each of multiple selected faces

How can i isolate only one determined edge per face, from a selection composed of multiple faces?

I want to ‘mark’ with a specific material several faces (walls) to have doors instanced on the middle point of their lower vertices. Mathematically I want geonodes to look at all the selected faces and return only the edge composed by the vertices with the lesser average Z when comparing it to other edges that share the same face.

I’ve got a similar result in a ‘controled environmet’. By using modulo I achieved what i want as long as there are no faces in the selection that share the same edge.

Another way i thought is setting mesh to point as “faces”, wich will result in a centralized point for each face, and then i could translate it on z axis by half the face height. My problem here is that with only ‘face area’ input field i’m restrained to square or fixed width walls.

Hi, have taken your questions as an inspiration to fulfill my long planned task to create an group attribute statistic node. There you can find insights and the solution to your problem.