You don't want to put Character A said, Character B replied all the time as it will be clunky and slow your pace down. You should do this at the start of the dialogue and, if it is a lengthy conversation, perhaps one other time during it, but there are other ways you can help your readers tell who is speaking. These include:-
- Style of speech. One of my characters will never use contractions, everyone else does so it is easy to tell when that character must be speaking. But there are other things that could be used here. For example, one character always ends their speech with a question. Another always uses a specific word in their conversation (they always call whoever they're talking to "darling" and you've established this early on in the tale so when this crops up again, your reader knows who it is speaking. There are countless other ways of doing this so pick something that would suit your character and set it up as a habit for that character early in the story.).
- Gestures. Does anyone ever not move when speaking? No! So establish Character A always fiddles with their hair, Character B waves their hands a lot etc. Again set this up early in the tale so when we read conversation where someone is fiddling with their hair, we know it is likely to be Character A. (I only say likely because gestures can be copied and often are when another character wants to fake the mannerisims of another for some dodgy reason of their own - and it will always be for a dodgy reason! Where you do have another character setting out to deceive by copying another's mannerisms, you can still get this character to give themselves away to the more alert reader by not getting the gesture quite right, not getting the style of speech that goes with it quite right and so on. Equally you can arrange for the impersonation to be a good one and the truth come out another way later on. But either way gestures can be a good way of giving depth to your characterisation. We all have specific gestures we use after all).
- Accents. Not quite the same thing as style of speech, which is why I've listed it separately. The thing I would caution against here is using too much in the way of accents in text as it can be difficult to read. Use a flavour of the character's accent - the odd word, the odd phrase (which can then be repeated when you need them) - which will show they are from a different area to someone else rather than have every single word "accented". I see accents as being like chilli powder. Use the right amount and they're fine. Use too much and... well it overwhelms the whole story, which is the last thing you want.