Emma Loves Parties

Time limit1sMemory limit128 MB

Problem

Emma has just graduated from high school. In her town it is a long-standing custom to hold many parties that every graduate may attend, and Emma, who loves parties, wants to attend as many of them as she possibly can.

On weekdays only two or three parties are held in the evening, but on Saturday parties run all day long. Some parties begin as early as 8:00 in the morning, and because the neighbors might complain, no party ever ends later than 24:00 (midnight).

Every party has a fixed start time and end time, and every party begins and ends exactly on the hour. To be polite, Emma must stay at each party she attends for at least 30 minutes, and she always keeps this rule. Emma can teleport, so travelling between parties takes no time at all. When there is no other party left for her to attend, she goes home.

Write a program that finds the maximum number of parties Emma can attend.

Input

The input consists of several test cases. Each test case begins with a line containing an integer $p$ ($p \le 100$), the number of parties held that day. A value of $p = 0$ marks the end of the input. Each of the following $p$ lines contains two integers $s$ and $e$ ($8 \le s < e \le 24$): $s$ is the party's start time and $e$ is its end time. Several different parties may have exactly the same start and end time — that is, the same $(s, e)$ pair may appear more than once — and each of them counts as a separate party.

Output

For each test case, print exactly one line in the following format:

On day d Emma can attend as many as n parties.

Here $n$ is the maximum number of parties Emma can attend and $d$ is the number of the test case (test cases are numbered starting from 1). Always write the word parties (plural), even when $n$ is 1.