Finding $f$ such that $f(x+\frac1y)+f(y+\frac1z)+f(z+\frac1x)=1$ for positive $x$, $y$, $z$ with $xyz=1$. Explain existing answer. USAMO Question 2 (via artofproblemsolving.com):

Find all functions $f:(0,\infty)\to(0,\infty)$ such that
  $$f\left(x+\frac1y\right)+f\left(y+\frac1z\right)+f\left(z+\frac1x\right)=1$$
  for all $x, y, z>0$ with $xyz=1$.

The link redirects to a forum on AoPS. Check USAMO 2's solution. The author claims that $g$ can (uniquely) be extended to an additive function $h$ on all of $\mathbb{R}$. I don't understand why this is true by the explanations below this statement. Please help me understand. Maybe define the function $h$ explicitely. I was thinking of something like 
$$h(x)=g\left(x-\left\lfloor x+\frac13 \right\rfloor\right)+3\left\lfloor x+\frac13 \right\rfloor g\left(\frac13 \right), \forall x\in \mathbb R$$ but I don't think this works.
If you can't explain the solution in the link above, but you have a solution to this problem which does not involve analysis (only algebra, and other than Evan Chen's solution / AoPS solutions which are very long and hard to find in a contest), please post it here. It will help. Thank you in advance!
 A: We have $g: (-\frac{1}{3},\frac{1}{3}) \to \mathbb{R}$ with $g(x+y) = g(x)+g(y)$. Define $G: \mathbb{R} \to \mathbb{R}$ by $G(x) = Ng(\frac{x}{N})$ where $N \in \mathbb{N}$ is large enough to ensure $|\frac{x}{N}| < \frac{1}{3}$. To see that the definition does not depend on $N$, i.e. to show $Ng(\frac{x}{N}) = Mg(\frac{x}{M})$ for any $M$ with $|\frac{x}{M}| < \frac{1}{3}$, it suffices to show both are equal to $NMg(\frac{x}{NM})$, which is clear from additivity. Let's show $G(x+y) = G(x)+G(y)$ for $x,y \in \mathbb{R}$. Fix $x,y \in \mathbb{R}$, and take $N$ large so that $|\frac{x}{N}|,|\frac{y}{N}|,|\frac{x+y}{N}| < \frac{1}{3}$; then $G(x+y) = Ng(\frac{x+y}{N})$ and $G(x)+G(y) = Ng(\frac{x}{N})+Ng(\frac{y}{N})$, so just use additivity of $g$. Finally, it is clear that $G$ extends $g$.
A: We can fix the extension part of the solution as follows. Put $U=\left( -\tfrac 13, \tfrac 23\right)$. 
We claim that for each $x_1,\dots,  x_k\in U$ with $x_1+\dots+x_k=0$ we have $g(x_1)+\dots+g(x_k)=0$. Let’s prove this claim by induction with respect to $k$. For $k\le 3$ the claim is given. Assume that the claim is proved for each $k\le n\ge 3$. Let   $x_1,\dots,  x_{n+1}\in U$ with $x_1+\dots+x_{n+1}=0$. Without loss of generality we can assume that $x_1\le 0\le x_2$, so $x_1+x_2\in [x_1, x_2]\subset U$. By the inductive hypothesis we have $$g(x_1+x_2)+g(x_3)+\dots+g(x_n)=0,$$ so it remains to prove that $g(x_1+x_2)=g(x_1)+g(x_2)$. It is easy to see that $-\tfrac{x_1+x_2}2\in U$, so $$g(x_1+x_2)+2g\left(-\tfrac{x_1+x_2}2\right)=0.$$ Similarly we have $$g(x_1)+2g\left(-\tfrac{x_1}2\right)=0\mbox{ and }g(x_2)+2g\left(-\tfrac{x_2}2\right)=0.$$ Moreover, $$g\left(-\tfrac{x_1+x_2}2\right)+ g\left(\tfrac{x_1}2\right)+ g\left(\tfrac{x_2}2\right)=0,$$
$$g\left(\tfrac{x_1}2\right)+ g\left(-\tfrac{x_1}2\right)=0,\mbox{ and } g\left(\tfrac{x_2}2\right)+ g\left(-\tfrac{x_1}2\right)=0.$$ It follows
$$g(x_1+x_2)=$$ $$-2g\left(-\frac{x_1+x_2}2\right)=2 g\left(\frac{x_1}2\right)+2g\left(\frac{x_2}2\right)=-2 g\left(-\frac{x_1}2\right)-2g\left(-\frac{2}2\right)=$$ $$g(x_1)+g(x_2).$$
Let $x\in\Bbb R$ be any number, $x=x_1+\dots+x_n$ and $x=x’_1+\dots+x’_m$ be two representations of $x$ with $x_1,\dots, x_n, x’_1,\dots, x’_m\in U$. Then $\pm \tfrac {x_i}2$ and $\pm \tfrac {x’_j}2$ belong to $U$ for each $i$ and $j$. By the claim we have 
$$g(x_1)+\dots+g(x_n)=$$
$$-2\left(g\left(-\frac{x_1}2\right)+\dots+ g\left(-\frac{x_n}2\right) \right)=$$
$$2\left(g\left(\frac{x’_1}2\right)+\dots+ g\left(\frac{x’_m}2\right) \right)=$$
$$-2\left(g\left(-\frac{x’_1}2\right)+\dots+ g\left(-\frac{x’_m}2\right) \right)=$$
$$g(x’_1)+\dots+g(x’_n).$$
Put $h(x)=g(x_1)+\dots+ g(x_n)$. The definition of $h(x)$ implies that $h$ is additive and an extension of $g$. The uniqueness of such an $h$ follows from its additivity and the claim, but I guess it is not needed for the solution, since existence of any additive extension of $g$ on $\Bbb R$ implies $g(x)=kx$ for some $k\in\left[-\tfrac 12,1\right]$.
