def extract_arguments(fh):
    datasets = []
    while True:
        L = float(fh.readline().strip())
        if L == 0:
            break
        n1 = int(fh.readline().strip())
        polygon1 = [tuple(map(int, fh.readline().strip().split())) for _ in range(n1)]
        n2 = int(fh.readline().strip())
        polygon2 = [tuple(map(int, fh.readline().strip().split())) for _ in range(n2)]
        datasets.append((L, polygon1, polygon2))
    return datasets

# Example usage:
# with open('input.txt', 'r') as fh:
#     datasets = extract_arguments(fh)
#     for dataset in datasets:
#         print(dataset)