Afghan rivals each sworn in as president