# Let’s Code in Python for HackerRank: Sorting Problem

You are given data in a tabular format. The data contains  rows, and each row contains  space separated elements.
You can imagine the  items to be different attributes, (like height, weight, energy, etc.) and each of the  rows as an instance or a sample.
Your task is to sort the table on the th attribute and print the final resulting table.
Note: If two attributes are the same for different rows, print the row that appeared first in the input.
Input Format
The first line contains  and  separated by a space.
The next  lines each contain  elements.
The last line contains .
Output Format
Print the  lines of the sorted table. Each line should contain the space separated elements. Check the sample below for clarity.
Sample Input
5 310 2 57 1 09 9 91 23 126 5 91
Sample Output
7 1 010 2 56 5 99 9 91 23 12
#!/bin/usr# Coded by @VK_Intel for HackerRanN, M = map(int, input().split(" "))rows = [input() for i in range(N)]K = int(input())class C:    @staticmethod    def func():        for row in sorted(rows, key=lambda row: int(row.split()[K])):            print(row)        returnif __name__ == "__main__":           try:        elem = C()        elem.func()    except Error as e:        print("Error", e)        raise