Answer
The magnet on which the North-South poles are marked can be used to find out the magnet out of two bars.
Take the magnet with North-South poles are marked, keep it close to both the iron bars, hence both magnets gets attracted to it since both are magnets.
To find out the poles of unknown magnet, we can use the repulsion test. North pole marked on the given magnet will repel the north pole of unknown magnet and vice-versa.