def extract_arguments(fh):
    datasets = []
    while True:
        H, W = map(int, fh.readline().strip().split())
        if H == 0 and W == 0:
            break
        matrix = []
        for _ in range(H):
            row = list(map(int, fh.readline().strip().split()))
            matrix.append(row)
        datasets.append((H, W, matrix))
    return datasets