Let $R$ be a noetherian integral domain and $K$ the quotient field of $R.$ Suppose $f \in K.$ Suppose for each maximal ideal $M$ of $R,$ we can find $h,k\in R$ so that $f = h/k$ and $k \not\in M$. Show $f \in R.$
Note: $R$ is not assumed a UFD!
My attempt: I tried to prove that the summation of ideals generated by all the k that are not in some maximal ideals is the whole ring. But I dont know how to use that to move on. Also, I do not understand how to show an element is in the ring. I tried to prove that k has to divide h, but since R is not a UFD, I am not sure to achieve that.