The 3D circulation of water masses in the Mediterranean Sea