c=[]for _ in range(int(input())): li=list(map(int,input().split())) li.pop(0) c.append(min(li))print(max(c))