which pharaoh ruled egypt for the longest period of time