func_code_string: #include <bits/stdc++.h>   using namespace std;   const int inf = int(1e9) + 7;   const double eps = 1e-9;   vector<pair<int, int> > g[111];   int dp[111][111][30];   int n, m;   int dfs(int u, int v, int x) {     if (dp[u][v][x]) return dp[u][v][x];     dp[u][v][x] = 2;     for (int i = 0; i < int((g[u]).size()); ++i) {       pair<int, int> to = g[u][i];       if (to.second >= x) {         if (dfs(v, to.first, to.second) == 2) {           dp[u][v][x] = 1;           break;         }       }     }     return dp[u][v][x];   }   int main() {     cin >> n >> m;     for (int i = 1; i <= m; ++i) {       int u, v;       char c;       cin >> u >> v >> c;       g[u].push_back(make_pair(v, c - 97));     }     for (int i = 1; i <= n; i++) {       for (int j = 0; j < 26; j++) {         dp[i][i][j] = 2;       }     }     for (int i = 1; i <= n; i++) {       for (int j = 1; j <= n; j++) {         if (!dp[i][j][0]) {           dfs(i, j, 0);         }         if (dp[i][j][0] == 1)           cout <<  A ;         else           cout <<  B ;       }       cout << endl;     }     return 0;   }   