output_description: Print the maximum possible number and the minimum possible number of
  respondents subscribing to both newspapers, in this order, with a space in
  between.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      N A B
attempt: if __name__ == "__main__":
      n = int(input())
      c = []
      d = []
      e = []
  
      for i in range(0, n):
          a, b = map(int, input().split())
          c.append(a)
          d.append(b)
          e.append(a + b)
  
      li1, li2 = sorted(e), sorted(range(len(e)), key=lambda k: e[k])
  
      turn = 0
      happy = 0
  
      for i in range(n - 1, -1, -1):
          now = li1[i]
          if turn == 0:
              max = 0
              maxKey = 0
              for j in range(i, -1, -1):
                  if now == li1[j] and max < c[li2[j]]:
                      max = c[li2[j]]
                      maxKey = j
                  else:
                      li2[i], li2[maxKey] = li2[maxKey], li2[i]
                      break
              happy += c[li2[i]]
          else:
  
              max = 0
              maxKey = 0
              for j in range(i, -1, -1):
                  if now == li1[j] and max < d[li2[j]]:
                      max = d[li2[j]]
                      maxKey = j
                  else:
                      li2[i], li2[maxKey] = li2[maxKey], li2[i]
                      break
  
              happy -= d[li2[i]]
          turn = (turn + 1) % 2
      print(happy)
  
problem_description: Statement
  
  We conducted a survey on newspaper subscriptions. More specifically, we asked
  each of the N respondents the following two questions:
  
    * Question 1: Are you subscribing to Newspaper X?
    * Question 2: Are you subscribing to Newspaper Y?
  
  As the result, A respondents answered "yes" to Question 1, and B respondents
  answered "yes" to Question 2.
  
  What are the maximum possible number and the minimum possible number of
  respondents subscribing to both newspapers X and Y?
  
  Write a program to answer this question.
samples: [{"input": "10 3 5", "output": "3 0\n    \n\nIn this sample, out of the 10 respondents, 3 answered they are subscribing to\nNewspaper X, and 5 answered they are subscribing to Newspaper Y.\n\nHere, the number of respondents subscribing to both newspapers is at most 3\nand at least 0.\n\n* * *"}, {"input": "10 7 5", "output": "5 2\n    \n\nIn this sample, out of the 10 respondents, 7 answered they are subscribing to\nNewspaper X, and 5 answered they are subscribing to Newspaper Y.\n\nHere, the number of respondents subscribing to both newspapers is at most 5\nand at least 2.\n\n* * *"}, {"input": "100 100 100", "output": "100 100"}]