Automatic surface crossings

I am creating a script that automatically finds the junction of any shape by taking a hand any communication with the rest of the first list and scripts continues with the remaining list.
-Examples: I have 3 planes of a quadrangle:
{(ABC), (BCD), (ACD)}

  • begin1: (ABC) intersects with {(BCD), (ACD)}
    => {BC, AC}
  • begin2: (BCD) intersects with {(ABC), (ACD)
    => {BC, AC}
  • begin3: (ACD) delivery whale {(ABC), (BCD)}
    => AC, CD
    . Now ear this step I met encountered a problem and can not solve the exact direction.

    My English is not good, sometimes difficult questions presented by the garden when I was suffering from the use of writing a new script in this file dyanmo. If you think it has anything unusual please or give me a suggestion.
    File Dynamo: DesignsScripsRoof.dyn (21.4 KB)
    File Model Revit:
    -Thank for all