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

# if __name__ == "__main__":
#     input_path = sys.argv[1]
#     with open(input_path, 'r') as fh: 
#         data_sets = extract_arguments(fh)
#         for H, W, orchard in data_sets:
#             f(H, W, orchard)