Language: C

int n,t;
int d[MAX],f[MAX],color[MAX];
int A[MAX][MAX];

int main(){
  int i,j,u,v,k;

  scanf("%d",&n);

 for(i=1 ; i<=n ; i++){
    for(j=1 ; j<=n ; j++){
      A[i][j]=0;
    }
  }

  for(i=0 ; i<n ; i++){
    scanf("%d %d",&u,&k);
    for(j=0 ; j<k ; j++){
      scanf("%d",&v);
      A[u][v]=1;
    }
  } 

  DFS();
  
  for(i=1 ; i<=n ; i++){
    printf("%d %d %d\n",i,d[i],f[i]);
  }
  
  return 0;
}

void DFS(){
  int i;
  for(i=1 ; i<=n ;i++){
    color[i]=W;
  }
  t = 0;
  for(i=1 ; i<=n ;i++){
    if(color[i]==W){
      visit(i);
    }
  }
}

void visit(int u){
  int i;

  color[u] = G;
  d[u] = ++t;

  for(i=1 ; i<=n ; i++){
    if(A[u][i]==0)continue;
    if(color[i]==W)visit(i);
  }
  color[u] = B;
  f[u] = ++t;
}

Compiler output:
main.c:2:7: error: 'MAX' undeclared here (not in a function)
    2 | int d[MAX],f[MAX],color[MAX];
      |       ^~~
main.c: In function 'main':
main.c:8:3: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
    8 |   scanf("%d",&n);
      |   ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
  +++ |+#include <stdio.h>
    1 | int n,t;
main.c:8:3: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
    8 |   scanf("%d",&n);
      |   ^~~~~
main.c:8:3: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:24:3: error: implicit declaration of function 'DFS' [-Wimplicit-function-declaration]
   24 |   DFS();
      |   ^~~
main.c:27:5: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   27 |     printf("%d %d %d\n",i,d[i],f[i]);
      |     ^~~~~~
main.c:27:5: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:27:5: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:27:5: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c: At top level:
main.c:33:6: warning: conflicting types for 'DFS'; have 'void()'
   33 | void DFS(){
      |      ^~~
main.c:24:3: note: previous implicit declaration of 'DFS' with type 'void()'
   24 |   DFS();
      |   ^~~
main.c: In function 'DFS':
main.c:36:14: error: 'W' undeclared (first use in this function)
   36 |     color[i]=W;
      |              ^
main.c:36:14: note: each undeclared identifier is reported only once for each function it appears in
main.c:41:7: error: implicit declaration of function 'visit' [-Wimplicit-function-declaration]
   41 |       visit(i);
      |       ^~~~~
main.c: At top level:
main.c:46:6: warning: conflicting types for 'visit'; have 'void(int)'
   46 | void visit(int u){
      |      ^~~~~
main.c:41:7: note: previous implicit declaration of 'visit' with type 'void(int)'
   41 |       visit(i);
      |       ^~~~~
main.c: In function 'visit':
main.c:49:14: error: 'G' undeclared (first use in this function)
   49 |   color[u] = G;
      |              ^
main.c:54:18: error: 'W' undeclared (first use in this function)
   54 |     if(color[i]==W)visit(i);
      |                  ^
main.c:56:14: error: 'B' undeclared (first use in this function)
   56 |   color[u] = B;
      |              ^