Three high-ranking Taliban prisoners have been swapped for American and Australian men who had been held hostage by the insurgent group since their abduction in 2016.