https://123dok.net/document/wq2145ry-metric-and-latticial-medians.html