Proof

By the extended Euclidean algorithm there exist polynomials a and b with af + bg = 1. Multiply this relation by h:

afh + bgh = h.

Since f | afh   and  f | bgh, it follows that  f | h.