The magnet on which the North-South poles are marked can be used to find the magnet out of the two bars.
Take the magnet with North-South poles marked and bring its North pole close to the ends of the two iron bars. If one of the iron bars repels the magnet and one of them gets attracted to it, then we’ll know that the bar repelling the magnet is also a magnet (like poles of a magnet repel each other).
But if both the iron bars attract the magnet, bring the South pole of the known magnet close to the ends of the two iron bars and see which iron bar repels the magnet. In this way you’ll be able to identify the magnet out of the two iron bars.
The end of the magnet which repels the North pole of the known magnet will be it’s North pole.