Teacher: In this task, you are given a natural language interpretation of commands (consist of logical operations) to select relevant rows from the given table. Your job is to generate command (in terms of logical operations) from given natural language interpretation. Define body (contains a collection of statements that define what the this logical operator does) of each logical operator between '{}' parenthesis. Here are the definitions of logical operators that you can use while generating command: 
 1. count: returns the number of rows in the view. 
 2. only: returns whether there is exactly one row in the view. 
 3. hop: returns the value under the header column of the row. 
 4. and: returns the boolean operation result of two arguments. 
 5. max/min/avg/sum: returns the max/min/average/sum of the values under the header column. 
 6. nth_max/nth_min: returns the n-th max/n-th min of the values under the header column. 
 7. argmax/argmin: returns the row with the max/min value in header column. 
 8. nth_argmax/nth_argmin: returns the row with the n-th max/min value in header column. 
 9. eq/not_eq: returns if the two arguments are equal. 
 10. round_eq: returns if the two arguments are roughly equal under certain tolerance. 
 11. greater/less: returns if the first argument is greater/less than the second argument. 
 12. diff: returns the difference between two arguments. 
 13. filter_eq/ filter_not_eq: returns the subview whose values under the header column is equal/not equal to the third argument. 
 14. filter_greater/filter_less: returns the subview whose values under the header column is greater/less than the third argument. 
 15. filter_greater_eq /filter_less_eq: returns the subview whose values under the header column is greater/less or equal than the third argument. 
 16. filter_all: returns the view itself for the case of describing the whole table 
 17. all_eq/not_eq: returns whether all the values under the header column are equal/not equal to the third argument. 
 18. all_greater/less: returns whether all the values under the header column are greater/less than the third argument. 
 19. all_greater_eq/less_eq: returns whether all the values under the header column are greater/less or equal to the third argument. 
 20. most_eq/not_eq: returns whether most of the values under the header column are equal/not equal to the third argument. 
 21. most_greater/less: returns whether most of the values under the header column are greater/less than the third argument. 
 22. most_greater_eq/less_eq: returns whether most of the values under the header column are greater/less or equal to the third argument.
Teacher: Now, understand the problem? If you are still confused, see the following example:
select the row whose attendance record of all rows is 3rd maximum. the competition record of this row is danish superliga 2005-06.
Solution: eq { hop { nth_argmax { all_rows ; attendance ; 3 } ; competition } ; danish superliga 2005 - 06 }
Reason: Here, the generated command using logical operators correctly selects third maximum from given table rows which is mentioned in natural language interpretation.

Now, solve this instance: select the rows whose segment a record fuzzily matches to metal detectors . take the episode record of this row . select the rows whose segment a record fuzzily matches to riding mowers . take the episode record of this row . the second record is 1 larger than the first record . the episode record of the first row is 151 . the episode record of the second row is 152 .
Student:
and { eq { diff { hop { filter_eq { all_rows ; segment a ; metal detectors } ; episode } ; hop { filter_eq { all_rows ; segment a ; riding mowers } ; episode } } ; -1 } ; and { eq { hop { filter_eq { all_rows ; segment a ; metal detectors } ; episode } ; 151 } ; eq { hop { filter_eq { all_rows ; segment a ; riding mowers } ; episode } ; 152 } } }