P12196 [AOJ] Sweet War
普及
题目描述

Example

Input

2 5 4
5 7
4 8

Output

8 7

输入格式

见题面

输出格式

见题面

样例输入
2 5 4 5 7 4 8
样例输出
8 7