def extract_arguments(fh):
    datasets = []
    while True:
        n, h = map(int, fh.readline().strip().split())
        if n == 0 and h == 0:
            break
        marks = []
        for _ in range(h):
            c, a, b = fh.readline().strip().split()
            a, b = int(a), int(b)
            marks.append((c, a, b))
        datasets.append((n, h, marks))
    return datasets

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