detect which button is pressed and use that value in switch statement?

I would use a for loop to read the 4 input pins with the pin numbers in an array.
Before you start the for loop set a flag variable to -1. Save the for loop variable value to the flag variable if you detect that an input is LOW (button pressed)

When the for loop is complete test the flag variable. If its value is not -1 then a keypress has been detected and the value will be between 0 and 3. Use this value as the row index to a 2 dimensional array with the columns holding the values (HIGH or LOW) to be output to the relays.

Iterate through the columns of the selected row of the array and set the outputs appropriately