First, in E3 of Data sheet add formula:

=LOOKUP(REPT("z",25),$E$4:E$4)&"_"&E5

copied across. This is to align the x and y to country for each column

Then in Inputs sheet, H4:

=IF(ISNUMBER(MATCH($E$7&"_"&$E$8,Data!$E$3:$M$3,0)),INDEX(Data!$E6:$M6,MATCH($E$7&"_"&$E$8,Data!$E$3:$M$3,0)),"")

copied down.