Unraveling the water degradation mechanism of MAPbI$_3$