Retrieving objects in order they are connected by attributes


Halo everybody, I hope to find some answer as I stucked.
I work on a small plugin for modelling. I have objects (names and quantity may vary) which
have connected attributes in a chain as follows:

–> obj_a attribute Out.Mesh -->obj_b attribute In.Mesh --> obj_c atribute Out.Mesh --> obj_d attribute In.Mesh ->etc.

There is no hierarchy except all objects are children of one group.
The thing I need to know in order to move forward : based on first selected object(group) - is get array of all objects which are connected
via out.mesh --> in.mesh attributes to each other in order they are connected regardless of they names.
Second, I need to know which object is connected as last and which as first.

It would be super If somebody could give some clue, I tried with listConnections but I don`t know hot to even start it.