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

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