INF = 1E9

while (n = gets.to_i) && n != 0
	h = Array.new
	a = Array.new(n, +INF)
	b = Array.new(n, -INF)
	(0...n).each do |i|
		h.push(Array.new)
		gets.split.each_with_index do |k, j|
			k = k.to_i
			h[i].push(k)
			a[i] = [a[i], k].min
			b[j] = [b[j], k].max
		end
	end
	ans = 0
	for i in (0...n)
		for j in (0...n)
			k = h[i][j]
			ans = k if k == a[i] && k == b[j]
		end
	end
	puts ans
end