Getting and printing stream hierarchy