Step 1: Think about who earned the profit:
Reserves and undistributed profits come from the past business. Every partner who was in the firm during those years helped to create them.
Step 2: Accounting entry:
At retirement the entry is: General Reserve A/c Dr. to All Partners' Capital A/c (in the old ratio). For a loss the entry is reversed. The entry credits or debits every partner, including the retiring one.
Step 3: Eliminate options:
If only the retiring partner got it, the continuing partners would lose their rights. If only the remaining partners got it, the retiring partner would lose his rights. A future partner has no right to past profits.
Step 4: Conclusion:
The answer is option 3, all the partners.
Final Answer:
The accumulated profit or loss belongs to all the partners, option 3.
\[ \boxed{\text{All the partners (Option 3)}} \]