Two Navy ships steer at the last minute to avoid a head-on crash