Fatah, Hamas reach understanding in Cairo