The question seems to have a typo. A real magnified image is formed when f < u < 2f. Moving the object closer to the lens (u < f) would produce a virtual image, not a real small image. Assuming the object is moved 30 cm AWAY from the lens (u2=60cm), a diminished image would form (u > 2f). For f=20cm, 2f=40cm. u1=30cm is between f and 2f (magnified), and u2=60cm is beyond 2f (diminished). This fits. Thus, f=20cm.