function parseInt(x) parse(Int, x) end

function main()
	n = parseInt.(split(readline()))
	ab = Array{Int}(2,n[1])
	for i in 1:n[1]
		ab[:,i] = readline() |> split |> x -> parseInt.(x)
	end
	maxa = maximum(ab[1,:])

	print(maxa)
end

main()