### main

loop do
  n = gets.strip.to_i
  break if n == 0

  mtx = n.times.map{[]}
  shortests = n.times.map{[]}
  tallests  = n.times.map{0}

  for y in (0...n)
    mtx[y] = gets.strip.split(' ').map(&:to_i)
    minv = mtx[y][0]
    for x in (0...n)
      v = mtx[y][x]
      minv = v if minv > v
      tallests[x] = v if tallests[x] < v
    end
    shortests[y] = (0...n).map{|x| mtx[y][x] == minv}
  end

  h = 0

  for x in (0...n)
    tv = tallests[x]
    for y in (0...n)
      if shortests[y][x] && mtx[y][x] == tv
        h = tv
        break
      end
    end
  end

  puts h
end