def extract_arguments(fh):
    datasets = []
    while True:
        NA = int(fh.readline().strip())
        if NA == 0:
            break
        deck_A = fh.readline().strip().split()
        NB = int(fh.readline().strip())
        deck_B = fh.readline().strip().split()
        datasets.append((NA, deck_A, NB, deck_B))
    return datasets

# if __name__ == "__main__":
#     input_path = sys.argv[1]
#     with open(input_path, 'r') as fh:
#         datasets = extract_arguments(fh)
#         # Process datasets