#!/usr/bin/python3
# Encoding: utf8

# INPUT: tokenized text (tokens separted by whitespaces)
# ARGUMENT: number of grams
# OUTPUT: each line is a n-gram

import sys

size = sys.argv[1]
size = int(size)


def ngrams(input, n):
    input = input.split(' ')
    output = []
    for i in range(len(input)-n+1):
        output.append(input[i:i+n])
    return output


for line in sys.stdin:  
    line = line.strip()

    if len(line)>1:
        result = ngrams(line,size) 
        for ngram in result:
            juntar = ""
           
            for token in ngram:
                juntar += token + " "
            print (juntar)

