Question: in which yuga ramayana happened?
Answer: According to the 'Yuga System' of Hinduism, Ramayana occurred in Treta Yuga while Mahabharata took place in Dwapara Yuga, several years after the Treta Yuga. So there are several instances that prove that Ramayana took place before Mahabharata but Ramayana was written much after the Mahabharata.