URI Online Judge | 1520

# Screws and Nuts

By Neilor Tonin, URI Brazil

Timelimit: 3

Peter is working in a new job at a screws and nuts store. Every week he will receive new orders of mixed screws in big boxes and he need to know where he must store these products.

Mango, that is Peter's supervisor, asked him to organize all screws and nuts in a huge rack, in order to be easy to answer where is possible to find each determinate set of screws and how many of each one these lots the store has.

Peter receives all screws and nuts in boxes labeled with the products size interval. For example, two boxes with the respective intervals (1, 2) and (4, 8) represent lots of products with size { 1, 2, 4, 5, 6, 7, 8 }. A screw and nut number may be present in more than one box, and it appears in the list once for each interval. For example, three boxes with the respective intervals (1, 3), (2, 4) and (3,5) represent lots of screws and nuts with size  {1, 2, 2, 3, 3, 3, 4, 4, 5}.

## Input

The input contains several test cases and ends with EOF. Each test case consists of many lines. The first line contains a positive integer N (N < 100) indicating the number of boxes of screws. The following N lines, each with two X and Y numbers (1 ≤ X < Y ≤ 100) representing the lot sizes of nuts and bolts present in the box. The next line of input contains a single positive integer Num (1 ≤ Num ≤ 100), which indicates the number that Mango want to search after all products are arranged on a shelf or rack.

Note The rack has shelves numbered from 0 to P, and this P must not exceed 10000.

## Output

Each test case must produce a single output line, indicating all the positions of the shelf in which the screw size Num can be found or otherwise, that the screw can not be found, as shown below.

 Sample Input Sample Output 3 1 3 2 4 3 5 4 4 1 3 2 4 1 5 3 6 3 2 1 3 3 5 7 4 found from 6 to 7 3 found from 5 to 8 7 not found