The triage uses probabilistic modelling to determine the conditions. It's not clinically correct to assume there is 1-to-1 mapping between the first reported symptoms and the condition.
The triage will consider both the reported symptoms before starting the triage assessment (it can be even more than two). In your example, the system will look in the database for all the conditions that have stomach ache and headache as symptoms and then try to narrow it down based on additional questions.
I suggest that you try typing a complaints that reflects your scenario in the Health Bot to understand how it behaves.