order tasks by dependencies