my $gram = shift;
my %stop;
open F, shift;
while (<F>) {
	chomp;
	$stop{$_} = 1;
}
close F;


open F, shift;

while (<F>) {
	chomp;
	$ligne = $_;
	if ($gram == 1) {
		/.* (.*)/; $w1 = $1;
		if (exists($stop{$w1})) {next;}
		print $ligne."\n";
	}
	if ($gram == 2) {
		/.* (.*?):(.*)/; $w1 = $1; $w2 = $2;
		if (exists($stop{$w1})) {next;}
		if (exists($stop{$w2})) {next;}
		print $ligne."\n";
	}
	if ($gram == 3) {
		/.* (.*?):(.*?):(.*)/; $w1 = $1; $w2 = $3;
		if (exists($stop{$w1})) {next;}
		if (exists($stop{$w2})) {next;}
		print $ligne."\n";
	}
	if ($gram == 4) {
		/.* (.*?):(.*?):(.*?):(.*)/; $w1 = $1; $w2 = $4;
		if (exists($stop{$w1})) {next;}
		if (exists($stop{$w2})) {next;}
		print $ligne."\n";
	}
	if ($gram == 5) {
		/.* (.*?):(.*?):(.*?):(.*?):(.*)/; $w1 = $1; $w2 = $5;
		if (exists($stop{$w1})) {next;}
		if (exists($stop{$w2})) {next;}
		print $ligne."\n";
	}
}
close F;
