LearnPy Hub
← File Handling problems
Medium

The Last k Lines

Read k, then n, then n lines; write the n lines to log.txt. Read the file and print its last k lines (all of them if there are fewer).

Input

k; n; n lines.

Output

Lines.

Sample 1

Input
2
4
a
b
c
d
Output
c
d

Sample 2

Input
5
2
x
y
Output
x
y
solution.py
Output appears here
The Last k Lines · Python practice problem · LearnPy Hub