Yemen's warring sides say they will release thousands of prisoners in largest exchange deal since the start of the war.