#!/usr/bin/perl -w

use v5.30;
use strict;

my %map;
my %no;
while (<>) {
	chomp;
	my ($id, $x, $y, $w, $h) = /(\d+)/g;
	my $o;
	for my $dx (0 .. $w-1) {
		for my $dy (0 .. $h-1) {
			if (defined $map{$x+$dx,$y+$dy}) {
				delete $no{$map{$x+$dx,$y+$dy}};
				$o++;
			}
			$map{$x+$dx,$y+$dy} = $id;
		}
	}
	$no{$id} = 1 if !$o;
}

say keys %no;
