func_code_string: #include <bits/stdc++.h>   using namespace std;   const int kN = 100 + 1;   const int kA = 256;   bool dp[kN][kN][kA];   bool used[kN][kN][kA];   vector<pair<int, int> > g[kN];   bool Dp(int u, int v, int mark) {     if (!used[u][v][mark]) {       used[u][v][mark] = true;       dp[u][v][mark] = false;       for (const auto& edge : g[u]) {         if (edge.second < mark) {           continue;         }         dp[u][v][mark] = dp[u][v][mark] || !Dp(v, edge.first, edge.second);       }     }     return dp[u][v][mark];   }   void Solve() {     int n, m;     cin >> n >> m;     for (int i = 0; i < m; ++i) {       int u, v;       char ch;       cin >> u >> v >> ch;       g[u - 1].emplace_back(v - 1, int(ch));     }     for (int u = 0; u < n; ++u) {       for (int v = 0; v < n; ++v) {         cout << (Dp(u, v, 0) ?  A  :  B );       }       cout <<   n ;     }   }   int main() {     std::ios_base::sync_with_stdio(false);     cin.tie(NULL);     int tests_count = 1;     for (int test_index = 0; test_index < tests_count; ++test_index) {       Solve();     }     return 0;   }   