sub root { my $self = shift; my $root = $self; $root = $_ while defined( $_ = $root->parent ); $root //= $self; return $root; }