#948
Silver IV
MALI
시간 제한
1s
메모리 제한
32MB
제출
0
정답
0
맞힌 사람
0
정답 비율
0.0%

문제

Author: Marko Ivanković, Filip Barl Mirko and Slavko are playing a new game. Again. Slavko starts each round by giving Mirko two numbers A and B, both smaller than 100. Mirko then has to slove the following task for Slavko: how to pair all given A numbers with all given B numbes so that the maximal sum of such pairs is as small as possible. In other words, if during previous rounds Slavko gave numbers a1, a2, a3 .... an and b1, b2, b3 ... bn, determine n pairings (ai, bj) such that each number in A sequence is used in exactley one pairing, and each number in B sequenct is used in exactely one pairing and the maximum of all sums ai + bj is minimal.

입력

The first line of input contains a single integer N (1 ≤ N ≤ 100000), number of rounds. Next N lines contain two integers A and B (1 ≤ A, B ≤ 100), numbers given by Slavko in that round.

출력

Output consists of N lines, one for each round. Each line should contain the smallest maximal sum for that round.

예제 입력 1

3
2 8
3 1
1 4

예제 출력 1

10
10
9

예제 입력 2

3
1 1
2 2
3 3

예제 출력 2

2
3
4
코드 제출

코드를 제출하려면 로그인이 필요합니다.

로그인
내 제출
제출 내역이 없습니다.
맞은 사람
아직 맞은 사람이 없습니다.
난이도 투표
Silver IV1명 투표· 약 1개월 전
로그인 후 AC 받으면 투표할 수 있습니다.
전체 제출
제출 내역이 없습니다.