Designing Power on failure system
Combine the three power sources with diodes and a simple linear regulator down to 5 or 3.3V, at fairly low current, for a microcontroller. That way, as long as any single one of the three supplies is active, the microcontroller is powered. Now it can measure which power supplies are working and decide how to route power.