using System.Collections.Generic;
public static void DFS(int n, List<int>[] G, List <int> T, int r)
bool[] used = new bool[n + 1];
Stack<int> S = new Stack<int>();
S.Push(r); used[r] = true; T[r]=0;
{ x = S.Peek(); k = G[x].Count;
{ y = G[x][k - 1]; G[x].RеmоvеAt (k - 1);
{ used [y] = true; T[y] = x; S.Push(y); }