def extract_arguments(fh):
    datasets = []
    while True:
        line = fh.readline().strip()
        if line == "0 0 0":
            break
        n, k, s = map(int, line.split())
        positions = []
        for _ in range(n):
            x, y, z = map(int, fh.readline().strip().split())
            positions.append((x, y, z))
        datasets.append((n, k, s, positions))
    return datasets