If you really want only a black box circuit as you've drawn, then use a single PIC10F200. Take two GPIO pins, and put a 4.7K resistor in series with the pin.
These are your inputs, can be +5 or GND, or switched. Use another GPIO pin as your signal output.
The 4.7k input resistors will limit the current and provide some input protection. You can also add clamping diodes for further input protection if you want.
The firmware in the PIC10F200 can use the timer to alternately set both pins to inputs, read the values, and look for binary 10 or binary 01 inputs.
If you don't get either of those two, then set one pin as input, the other as output and read for a switch closure. If you read a switch closure,
do a debounce delay and read again.
Rinse. Repeat.
The PIC10F200 is really, really cheap, and perfect for this job. You can also do the same with any two available GPIO pins of your existing microcontroller,
if you have the spare pins.