def extract_arguments(fh):
    # Read the first line and parse A, B, M
    A, B, M = map(int, fh.readline().strip().split())

    # Read the next A lines for refrigerator prices
    a = list(map(int, fh.readline().strip().split()))

    # Read the next B lines for microwave prices
    b = list(map(int, fh.readline().strip().split()))

    # Initialize the discount tickets as an empty list
    discounts = []

    # Read the next M lines for discount tickets
    for _ in range(M):
        x, y, c = map(int, fh.readline().strip().split())
        discounts.append((x, y, c))

    return A, B, M, a, b, discounts

# if __name__ == "__main__":
#     input_path = sys.argv[1]
#     with open(input_path, 'r') as fh: 
#     A, B, M, a, b, discounts = extract_arguments(fh)
#     f(A, B, M, a, b, discounts)