# use strict; # use warnings; my %d; $d{$_} = 0 foreach 0 .. 9; <>; while (<>) { chomp; my @x = split(/\s/); my @ds = @x[0 .. ($#x - 1)]; my $b = $x[-1]; if ($b eq 'NO') { delete $d{$_} foreach @ds; } last if scalar(keys(%d)) == 1; } print((keys(%d))[0], "\n");