Rulings allow Trump administration to end Temporary Protected Status for nationals of the two countries.