# Add or remove imports
import random
from yogi import scan

# Change 'function_name' to your function name,
# and addapt the way input must be read to your needs.
x = scan(int)
while x is not None:
    M = []
    for _ in range(x) :
        row = []
        for _ in range(x) : 
            row.append(scan(int))
        M.append(row)
    
    print(minMax(M))
    x = scan(int)

    
    