Athlete Sort

  • + 0 comments

    if name == 'main': first_multiple_input = input().rstrip().split()

    n = int(first_multiple_input[0])
    
    m = int(first_multiple_input[1])
    
    arr = []
    
    for _ in range(n):
        arr.append(list(map(int, input().rstrip().split())))
    
    k = int(input().strip())
    
    val = sorted(arr, key=lambda x: x[k])
    [print(*i) for i in val]