Set each capital, the month B joins, the month A leaves, and the profit. The first step prints the timeline as month numbers and tells you how long the two partners overlapped — which is information you never use, and seeing that is the point.
A ₹20,000 for 6 months, B ₹30,000 for 9
4 : 9 · 12,000 and 27,000
Set B to join at month 4 and A to leave at month 4 and you get a clean handover: no overlap, and the same rule still prices it.