4. Check for neighbors in corner cases.