$K(Y)$ is isomorphic to the quotient field of $A(Y).$ I am doing some self study on Algebraic Geometry and following Hartshornes Algebraic Geometry book. I have some difficulties in understanding Theorem 3.2 from chapter 1. I am stating it below.
Let $Y \subset \mathbb{A}^n$ be an affine variety with affine coordinate ring $A(Y)=A/I(Y),$ where $A=K[X_1,\ldots,X_n].$ I stuck in (d) where it states that $K(Y)$ is isomorphic to the quotient field of $A(Y),$ where the function field $K(Y)$ is defined as the equivalence class of $<U,f>$ where $f: U \to K$ is regular map and consider the identification $<U,f>=<V,g>$ when $f=g$ on $U \cap V$( which is always non-empty since $Y$ is irreducible). I understand that quotient field of $A(Y)$ is isomorphic to the quotient field of $\mathscr{O}_p$ (where $\mathscr{O}_p$ denotes the local ring at the point $p \in Y)$ is contained in the function field $K(Y).$ Only thing troubled me  is the line where it states every rational function is in some $\mathscr{O}_p.$ I stuck here how it shows that quotient field of $\mathscr{O}_p$ is equal to $K(Y)$ ?
In my thought it may happen that for different $p \in Y$ the quotient field of $\mathscr{O}_p$ has different copy in $K(Y).$Or may be I am missing something. I need your help. Many thanks.

Note that the natural map $\mathscr{O}(Y) \rightarrow K(Y)$ factors through $\mathscr{O}_p$ for any $p$. So if you consider the induced map on quotient fields $A(Y) \rightarrow K(Y)$, then this factors through $A(Y) \rightarrow Frac(\mathscr{O}_p) \rightarrow K(Y)$ for any $p$, (note that the composition still gives the same map). Using this and the fact that every rational function is contained in some $\mathscr{O}_p$ should give you the claim. 
