Dear Abhishek
Let the output of both engines be W
Let the 1st engine take Q1 heat as input at temperature T1= 800 K and gives out heat Q2 at temperature T2. Second engine receives Q2 heat as input and gives out heat Q3 at temperature T3 = 300K to the sink.
Work done by first engine W = Q1-Q2
Work done by second engine W = Q2-Q3
Thus
Q1-Q2 = Q2-Q3
Dividing both sides by Q1
1- Q2/Q1 = Q2/Q1 - Q3/Q1
1-T2/T1 = Q2/Q1(1-Q3/Q2)
=> Solving this you'll get T = 550K