x....f(x)....g(x)....h(x)

0.....1.......5

1.....0.......2

2.....5.......3

3.....2.......1

4.....3.......4

5.....4.......8

basically you have to look up the values from the table, h(x)=f(g(x) so for x=0:

g(0)=5

f(5)=4

so h(0)=4

this works for all but the last value which according to the problem statement f(8) is out of the domain.