Type: Default 1000ms 256MiB

G.景点

You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.

背景

ZSC001第七题。

题目描述

nn个景点,第ii个景点的门票需要aia_i元钱,需要路费bib_i元钱。现在,张锦程要去其中的一个景点,他最多会花多少钱?最少会花多少钱?

格式

输入

n+1n+1行,第一行是nn,后面nn行每行有两个数,第i+1i+1行的两个数分别是aia_ibib_i

Output

两行,分别有一个数,第一行是张锦程最多花的钱数,第二行是张锦程最少花的钱数(单位:元)

Samples

5
2 3
4 7
3 5
7 2
8 1
11
5
10
2 3
4 7
3 5
7 2
8 1
9 9
10 12
1 0
5 3
5 5
22
1