I have an image which looks like this:

However the yellow line needs to be red and the cyan line needs to be green. I have MS Paint and IrfanView.
How can I change the colors of the yellow and cyan line without individually selecting all pixels manually?
I.e. what is a good way of changing all pixels of one color to another color?