I've got nodetypeA that has a nodereference to nodetypeB that has a nodereference to nodetypeC.

When standing on a node of nodetypeA how can I get nodetypeC-nid in this structure?