#!/usr/bin/perl

my $nbMax = 50;

if(@ARGV == 1){
	$nbMax = $ARGV[0];
}

while(<STDIN>){
	my @splittedLine = split(/ /, $_);
	if(@splittedLine < $nbMax + 3){
		print $_;
	}
}
