Question
Implement a deterministic battle between two teams of creatures. Team A acts first. On each turn, the first living creature on the active team attacks the first living creature on the opposing team.
```python
class Creature:
name: str
health: int
attack: int
def battle(team_a: list[Creature], team_b: list[Creature]) -> tuple[str, list[str]]: ...
```
## Requirements
- Damage reduces health; a creature with health `<= 0` is knocked out and cannot act.
- Alternate teams after every attack, skipping a side only if it has no living creature—at which point the battle ends.
- Log every attack, knockout, and final winner in a deterministic format agreed before coding.
- Do not mutate caller-owned teams unless the API explicitly documents it.
- Validate empty teams, non-positive attack values, and battles that cannot make progress.
## Follow-ups
1. Order turns by speed rather than alternating teams.
2. Add revival or extra lives.
3. Support target selection and area attacks.
4. Make replay deterministic from an event log and random seed.