from typing import MutableSequence
from typing import Any


def swap(seq: MutableSequence[Any], frst_idx: int, snd_idx: int) -> MutableSequence[Any]:
    """Swaps two elements in the `seq`."""
    if seq[frst_idx] == seq[snd_idx]:
        return seq
    seq[frst_idx], seq[snd_idx] = seq[snd_idx], seq[frst_idx]
    return seq