The probabilistic nature of McShane’s identity: planar tree coding of simple loops