A curve with Cartesian equation y=f(x) passes through origin. Lines drawn parallel to the coordinate axes through an arbitrary point of the curve form a rectangle with two sides on the axes. The curve divides every such rectangle into two regions A and B, one of which has an area equal to n times the other. Find the function f.