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