Hi
One of the was in which this could probably be done is to set A, B and C as Intercompany customer and vendors in each other along with trading partners. For payable and recicvable you will get the trading partners populated. For the offsetting GL Line Items, set up a substitution rule to populate the trading partner
regards
Sanil