Task: Text to Code
Input (English): select the row whose total elected 2001 record of all rows is 2nd maximum . the party record of this row is democratic party .
Output (English): eq { hop { nth_argmax { all_rows ; total elected 2001 ; 2 } ; party } ; democratic party }