Simply, first you should notice the fact that the complex B-E junction in darlington enables the flow of the emiter current from PN2222.
Get it?
If not, once again, but with details this time.
Let us assume +5V at the input A .
The current splits:
1.
part of it flow through R3 to Q7 base.
Q7 is saturated and "short circuit" darlington Q3 input.
Darlington Q3 "opens" (ie no current can flow through its collector)
2.
The second part goes to Q5 base" turning Q5 in conduct mode, base current flows to emiter, R1 Q4 base and via two B-E diodes inside darlington Q4 to ground.
Because the base current flows, as a result Q5 works as emitter follower, the voltage at its emmiter is 0,6 V lower than the voltage at the base.
The voltage at Q5 collector is equal "Power voltage" minus 1,2V (B-E drop on two Q1 B-E junctions). This voltage is independent of the current.
Q4 is saturated so on its base is the voltage 1,2V (two B-E junction voltage)
Finally the voltage drop at R1 is equal:
5V - 0,6V -1,2V = 3,2 V
The R1 current is equal 68 mA
This current goes to Q5 collector and next to the base of Q1 . This current saturates the Q1.
The case when voltage is applied at input B is "mirror reflection" of the described one.
What when two inputs are high?
You have enough foot to think and (I hope) good background.
(What if not?, well, may be next time)