Language: C++

#include <bits/stdc++.h>
using namespace std;
#define For(i, n) for(int i = 1; i <= n; ++i)

bool used[10005];
set <int> arr[10005];
int timer[10005];


int main() {
    int n, m, a, b;
    cin >> n >> m;
    For(i, m) {
        cin >> a >> b;
        arr[a].insert(b);
        timer[i] = 0;
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }v
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }

    int max_ = timer[1];
    For(i, n - 1) {
        if(timer[i + 1] > max_) max_ = timer[i + 1];
    }
    cout << max_;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:791:6: error: 'v' was not declared in this scope
  791 |     }v
      |      ^
a.cc:793:9: error: 'i' was not declared in this scope
  793 |     For(i, n) {
      |         ^
a.cc:3:34: note: in definition of macro 'For'
    3 | #define For(i, n) for(int i = 1; i <= n; ++i)
      |                                  ^