import sys
import heapq
input = sys.stdin.readline
n = int(input())
table=[]
for i in range(n):
table.append(list(map(int, input().split())))
heap = []
for i in range(n):
for j in range(n):
heapq.heappush(heap, table[i][j])
if len(heap)>n:
heapq.heappop(heap)
print(heap[0])
pypy3로 제출해야 함. python3로 제출하면 메모리 초과 발생