### main

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

  shortests = n.times.map{n.times.map{false}}
  tallests  = n.times.map{[0, -1]}

  for y in (0...n)
    rows = gets.strip.split(' ').map(&:to_i)
    minv = [rows[0], 0]
    for x in (0...n)
      v = rows[x]
      minv = [v, x] if minv[0] > v
      tallests[x] = [v, y] if tallests[x][0] < v
    end
    shortests[y][minv[1]] = true
  end

  h = 0

  for x in (0...n)
    tv, ty = tallests[x]
    if shortests[ty][x]
      h = tv
      break
    end
  end

  puts h
end