Assuming your categories are in a parent=>child hierarchy as listed(ie category4 is a child of category 3, etc) then this should give you what you’re after:
the_category("»", "multiple", $post->ID);
Assuming your categories are in a parent=>child hierarchy as listed(ie category4 is a child of category 3, etc) then this should give you what you’re after:
the_category("»", "multiple", $post->ID);