A nonlinear inverse problem for the wave equation