In Step 1, you correctly state that "A gives B a 40 m start, A wins by 19 seconds: so B runs 960 m in x+19 seconds and A runs 1000 m in x seconds."
Then Speed A should be defined by the ratio of the distance A runs (refer to your statement, A runs 1000m) to the time A takes (still refer to your statement, it's x seconds). So Speed A = 1000/x. Similarly, Speed B=960/(19+x).
In Step 2, you define that "A runs 960m in y secons" and correctly define Speed A=960/y. The mistakes comes from the time you think it takes for B. Since B first runs 30 seconds while A stands still, and B then runs another y seconds together with A: So B totally runs 1000m in (y+30) seconds (instead of y-30 as you suggested).
Double check your definitions of Speed A and Speed B and you can get the sample answer 125 and 150.