Task: Text to Code
Input (English): select the row whose swing to gain record of all rows is 3rd maximum . the constituency record of this row is ayr .
Output (English): eq { hop { nth_argmax { all_rows ; swing to gain ; 3 } ; constituency } ; ayr }