Given a large UTF-8 text file, write a program that prints the K-th non-empty line. Do not load the whole file into memory. Specify how you handle files with fewer than K non-empty lines, blank lines, and trailing newline behavior. Provide code in a language of your choice and discuss time and space complexity.