def extract_arguments(fh):
    datasets = []
    while True:
        n, m, p = map(int, fh.readline().strip().split())
        if n == 0 and m == 0 and p == 0:
            break
        edges = [tuple(map(int, fh.readline().strip().split())) for _ in range(m)]
        children_nodes = [int(fh.readline().strip()) for _ in range(p)]
        datasets.append((n, m, p, edges, children_nodes))
    return datasets

# Example usage
# with open('input.txt', 'r') as fh:
#     data = extract_arguments(fh)