import numpy as np

if __name__ == '__main__':

    h, w = map( int, input().split() )

    row_list = []

    for i in range(h):

        single_row = list( map(int, input().split() ) ) 

        np_row = np.array( single_row )

        row_list.append( np_row )


    min_of_each_row = np.min( row_list, axis = 1)

    max_of_min = np.max( min_of_each_row )

    print( max_of_min )



[((18, 22, 18, 49), 'numpy.min', 'np.min', (), '', True, 'import numpy as np\n'), ((20, 17, 20, 42), 'numpy.max', 'np.max', ({(20, 25, 20, 40): 'min_of_each_row'}, {}), '(min_of_each_row)', True, 'import numpy as np\n'), ((13, 17, 13, 39), 'numpy.array', 'np.array', ({(13, 27, 13, 37): 'single_row'}, {}), '(single_row)', True, 'import numpy as np\n')]