Challenge-Response Phases in IND-CPA The IND-CPA game has two challenge-response phases


A key is generated by running $Gen(1^n)$ and challenger selects a bit
b {0,1} uniformly at random.
Adversary gets input $1^n$.
Can query the oracle a polynomial number of times with messages and gets $E_k(m)$ back.
Attacker sends messages $m_0$, $m_1$, challenger returns $E_k(m_b)$.
Can query the oracle a polynomial number of times with messages and gets $E_k(m)$ back.


Why are these two challenge-response phases (3,5) necessary? I understand why at least one phase is necessary (ex: to ensure that deterministic algorithms are not IND-CPA secure), but why both?
You need to allow queries before the attacker outputs $m_0,m_1$ since maybe the queries help the attacker choose $m_0,m_1$ that are "easier" for it to attack.

You need to allow queries after the attacker receives back the challenge ciphertext $c=E_k(m_b)$ since knowing $c$ may make it possible to generate a plaintext whose encryption helps to know what $c$ is.