order output in dependency order