The monasteries that now sit atop some mountains were built in the 14th century for monks to escape danger.