The middle person sends her own public value to both sides.
Eve chooses her own secret
Eve chooses e=10 and publishes E=9.
E=510mod23=9
The same E is sent both ways
Alice receives E instead of B, and Bob receives E instead of A.
both sides see E
The real pair never meets
Alice does not use B=19, and Bob does not use A=8.
A=8B=19
Summary
The replacement makes each endpoint do correct math with the wrong public value.
same table, different transcript