#! /usr/bin/perl

use strict;
use warnings;

my $fh;
my %seen_recv = ();

# Receiver
open $fh, "<", $ARGV[1]
	or die "$ARGV[1]: $!";
while (<$fh>) {
	tr/\r\n//d;
	/^(\d+)$/ or next;
	$seen_recv{$1} = 1;
}
close $fh;

# Sender
open $fh, "<", $ARGV[0]
	or die "$ARGV[0]: $!";
while (<$fh>) {
	tr/\r\n//d;
	/^\d+(?: \d+)* $/ or next;
	for my $n (split) {
		if (exists($seen_recv{$n})) {
			print "$n ";
		} else {
			print "$n* ";
		}
	}
	print "\n";
}
close $fh;


