Right, i'm doing semester 2 analysis and i'm completely stumped, have no idea where to start on this question:

Let f be a map from an interval I to the reals (not necessarily continuous). Prove the equivalence of the two statements:

(i) if x,y are contained within I with f(x)<f(y), then for all c in (f(x),f(y)) there exists z in (x,y) union (y,x) : f(z) =c

(ii) if J, a subset of I, is any interval, then f(J) is an interval

any help would be appreciated, thanks