def latest_actions_only(items):
    """Keep only the most recent occurrence of each action, while preserving the order"""
    used = set()
    res = []
    for item in reversed(items):
        if item not in used:
            res.append(item)
            used.add(item)
    return reversed(res)