def extract_arguments(fh):
    datasets = []
    while True:
        N = int(fh.readline().strip())
        if N == 0:
            break
        elevators = []
        for _ in range(N):
            low, high = map(int, fh.readline().strip().split())
            elevators.append((low, high))
        datasets.append((N, elevators))
    return datasets