Treatment of compound O with KMnO4/H+ gave P, which on heating with ammonia gave Q. The compound Q on treatment with Br2/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 R is: