import java.util.Scanner;
// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int range = Integer.parseInt(in.nextLine());//评分区间长度
String s = in.nextLine();
String array[] = s.split(",");
int scoreArray[] = new int[array.length];
String worstScoreString="";//最差产品评分序列
int worstScore;//小组最差评分
//string数组转int数组
for (int i = 0; i < array.length; i++) {
scoreArray[i] = Integer.parseInt(array[i]);
}
//以range长度为一组查找最小值
for (int i = 0; i <= scoreArray.length-range; i++) {
worstScore = scoreArray[i];
for (int j = i; j <i+ range ; j++) {
if (scoreArray[j] < worstScore)
worstScore = scoreArray[j];
}
worstScoreString+=worstScore+",";
}
System.out.print(worstScoreString);
}
}