YOLO annotation guildelines: overlapping and partially visible objects
There is only 1 restriction, your truth bboxes with the same class_id shouldn't be overlapped more than IoU > 45%, because Yolo uses nms_threshold = 0.45.

In general, you should mark your objects in such a way as you want to detect these objects.