You work in an online store and you need to create a system for sorting goods according to various criteria. Each product has a name, price and rating. It is necessary to realize a higher order function that creates specialized sorters for a list of goods.
rn
The function should take the design criterion (name, price or rating) and direction (by increasing or decreasing), and return the function-sorter that sorts the list of goods according to the specified parameters.
Input format
The first line contains the amount of goods n.
the last line contains a criterion of sorting and a direction: criterion: name/price/rating, direction: ASC/DesC) DIV>
Output format
sorted list of goods, each product on a separate line in format: name the price rating
Example
Input
4
Laptop 50000 4.5
Mouse 1500 4.2
Keyboard 3000 4.8
Monitor 25000 4.1
Price asc
Output
mouse 1500 4.2
Keyboard 3000 4.8
Monitor 25000 4.1
Laptop 50000 4.5
Hint
There will be no clue here, decide for yourself!