def is_the(word):
    import string
    clean = word.strip(string.punctuation)
    return clean.lower() == 'the'


with open('input.txt', 'r', encoding='utf-8') as f:
    lines = f.readlines()

with open('output.txt', 'w', encoding='utf-8') as f_out:
    for line_num, line in enumerate(lines, start=1):
        words = line.split()

        count = 0
        for word in words:
            if is_the(word):
                count += 1

        if count > 0:
            f_out.write(f"{line_num} {count}\n")