If he remembers a missed prayer during the current prayer or after finishing it
If you have prayed the current prayer, then you remember a missed prayer from the same day or a previous day, you should pray it, but do not repeat the current prayer, because the Prophet (peace and blessings of Allaah be upon him) said: “Whoever forgets a prayer, let him offer it as soon as he remembers, for there is no expiation for it other than that. ‘and perform As‑Salaah (Iqaamat‑as‑Salaah) for My remembrance’ [Ta-Ha 20:14].” Narrated by al-Bukhaari (597) and Muslim (684).
Al-Nawawi (may Allaah have mercy on him) said: The words of the Prophet (peace and blessings of Allaah be upon him), “Whoever forgets a prayer, let him offer it as soon as he remembers, for there is no expiation for it other than that” mean: nothing will make up for it except a prayer like it, and he does not have to do anything else. End quote.
Based on this, then in the case asked about here, you have to pray Fajr as soon as you remember it, and do not repeat Maghrib.
But if a person remembers a missed prayer during the current prayer, should he complete it or interrupt it? There is a difference of opinion among the fuqaha’. Abu Haneefah and Maalik were of the view that the current prayer becomes invalid, so he should offer the missed prayer first and then the current prayer. The Shaafa’is were of the view that he should complete the current prayer and then offer the missed the prayer, and it is mustahabb for him to repeat the current prayer. Ahmad was of the view that he should complete the current prayer, then make up the missed prayer, then repeat the current prayer as something obligatory.
This has been discussed in the answer to question no. 30788, where we stated that repeating the current prayer is better, in order to be on the safe side.
And Allaah knows best.