from __future__ import annotations

import sys
from pathlib import Path


def main() -> None:
    if len(sys.argv) < 4 or len(sys.argv[2:]) % 2:
        raise SystemExit("usage: print_text_lines.py <txt> <start> <end> [<start> <end> ...]")
    lines = Path(sys.argv[1]).read_text(encoding="utf-8").splitlines()
    args = [int(value) for value in sys.argv[2:]]
    for start, end in zip(args[::2], args[1::2]):
        print(f"---LINES {start}-{end}---")
        for index in range(start - 1, min(end, len(lines))):
            print(f"{index + 1}: {lines[index]}")


if __name__ == "__main__":
    main()
