Treatment of compound O with $KMnO_{4}/H^{+}$ gave P, which on heating with ammonia gave Q. The compound Q on treatment with $Br_{2}/NaOH$ produced R on strong heating, Q gave S which on further treatment with ethyl 2-bromopropanoate in the presence of KOH followed by acidification gave a compound T
The compound T is