Maximally entangled states of N spatially separated cavities