import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Collections;
import java.util.PriorityQueue;
import java.util.StringTokenizer;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int N = Integer.parseInt(br.readLine());
PriorityQueue<Integer> pq = new PriorityQueue<>(Collections.reverseOrder());
for (int i = 0; i < N; i++) {
StringTokenizer st = new StringTokenizer(br.readLine());
while (st.hasMoreTokens()) {
pq.offer(Integer.parseInt(st.nextToken()));
}
}
int answer = Integer.MIN_VALUE;
for(int i=0; i<N ;i++) {
answer = pq.poll();
}
System.out.println(answer);
}
}