Task: Text to Code
Input (English): select the row whose semifinalists record of all rows is 2nd maximum . the country / territory record of this row is south africa .
Output (English): eq { hop { nth_argmax { all_rows ; semifinalists ; 2 } ; country / territory } ; south africa }