INDEX returns the value of the cell which is in entire (third parameter missed or zero) row (first parameter) on position defined with second parameter.
We find that position using AGGREGATE. It return Nth (fourth parameter) smallest (first parameter 15) from the array (third parameter) ignoring all errors (second parameter 6). As an array we take column numbers of your data range multiplying them on 1/ logical check if the cell has the value "x". Since TRUE is equal to 1 and FALSE to 0, we have an array with ignoring errors or 1s. For the first current column 4th parameters return 1 (thus you find first smallest column number for the cell with "x"), for the next cell it'll be second smallest, etc.
Finally we wrap entire formula with IFERROR to return empty string if Nth smallest is not found.
You may stay on the cell with formula and check calculations by steps with Formula-Evaluate formula on ribbon.
Previous time I overcomplicated the formula a bit, it could be like