XOR function 36V 4A

Hello 

I am trying to find a chip or circuit that can help me designing a XOR function (power multiplexer) capable to handle 3 Vin of 36V to a Vout of 36V with a maximum current flowing trough of 4A.

I have some switching criteria as follow: 

Vin 3 power adapter

Vin 1: battery pack 1

Vin 2: battery pack 2

If Vin 3 is on => XOR output = Vin 3

If Vin 3 is off => XOR output is is on Vin 1 or Vin 2 based on voltage (the one with the highest voltage got priority)

Does anybody got idea about how I can achieve this ?