Detect tag during dfs