The 8 wire distributor is the correct one for 4afe as it has a cam sensor (tdc1 sensor) built into it, 5afe dont use it
The wiring is pretty simple
6 wire plug is
2 wires to NE+ and NE- (crank sensor)
2 wires to G- and G+ or G1 (cam sensor)
1 wire to IGT (Ignition trigger)
1 wire to IGF Ignition feedback - this is toyota system of knowing igniter fired)
2 wire plug
1 wire is 12v+ from key
1 wire is rpm feed (thin one, it also ends is in dlc2 in engine room)
6 wire distributor is similar except it doesnt have G- and G+ wiring
Using the 5afe distributor will result in a bumpy lag on initial acceleration as the ecu needs it to time the injector sequence.