Remember that
The speed is equal to divide the distance by the time
speed=d/t
Let
x ----> speed plane 1
x+40 ----> speed plane 2
we know that
the initial distance between them is 3,950 miles
d=speed*t
when they pass each other
distance plane 1 -----> d1=x*5=5x
distance plane 2-----> d2=(x+40)*5=5x+200
we have that
d1+d2=3,950
substitute
5x+5x+200=3,950
10x=3,950-200
10x=3,750
x=375
x+40=415
therefore
the speed of the planes are 375 mph and 415 mph