Sherlock Holmes is investigating a crime at Piccadilly Circus. He wants to know the maximum and the minimum number of people who were at the crime scene at the same time during the interval when the crime could have been committed. Scotland Yard interviewed everyone who was seen at the scene and, for each person, established the moment they arrived and the moment they left. Doctor Watson offered to process the data and work out the numbers Holmes is interested in, but he is struggling. Help him.
Time is measured in whole (integer) units. A person who arrived at moment ai and left at moment bi was present at every integer moment t with ai≤t≤bi. The crime could have been committed at any integer moment t in the interval [p,k].
Write a program that:
The first line contains two integers p and k (0≤p≤k≤109): the earliest and the latest moment at which the crime could have been committed.
The second line contains one integer n (3≤n≤5000): the number of people interviewed by Scotland Yard.
Each of the next n lines contains two integers ai and bi separated by a single space (0≤ai≤bi≤109): the moment the i-th person arrived at the scene and the moment they left. The i-th person was present at the scene for the whole time from moment ai to moment bi inclusive.
Print a single line with two integers separated by a single space: the minimum and the maximum number of people who were at the crime scene at the same moment during the interval from moment p to moment k inclusive.