func_code_string: #include <bits/stdc++.h>   using namespace std;   inline void read(int &x) {     char ch;     bool flag = false;     for (ch = getchar(); !isdigit(ch); ch = getchar())       if (ch ==  - ) flag = true;     for (x = 0; isdigit(ch); x = x * 10 + ch -  0 , ch = getchar())       ;     x = flag ? -x : x;   }   inline void write(int x) {     static const int maxlen = 100;     static char s[maxlen];     if (x < 0) {       putchar( - );       x = -x;     }     if (!x) {       putchar( 0 );       return;     }     int len = 0;     for (; x; x /= 10) s[len++] = x % 10 +  0 ;     for (int i = len - 1; i >= 0; --i) putchar(s[i]);   }   int n, m;   int pre[11000], now[110], son[11000], v[11000], tot;   int f[110][110][30];   char s[100];   void build(int a, int b, int c) {     pre[++tot] = now[a];     now[a] = tot;     son[tot] = b;     v[tot] = c;   }   int dfs(int x, int y, int MAX) {     if (f[x][y][MAX] != -1) return f[x][y][MAX];     set<int> S;     for (int p = now[x]; p; p = pre[p])       if (v[p] >= MAX) S.insert(dfs(y, son[p], v[p]));     int q = -1;     for (auto t : S) {       if (t != q + 1) break;       q = t;     }     return f[x][y][MAX] = q + 1;   }   int main() {     read(n);     read(m);     for (int i = 1; i <= m; i++) {       int a, b;       read(a);       read(b);       scanf( %s , s);       build(a, b, s[0] -  a  + 1);     }     memset(f, -1, sizeof(f));     for (int i = 1; i <= n; i++)       for (int j = 1; j <= n; j++) dfs(i, j, 0);     for (int i = 1; i <= n; i++) {       for (int j = 1; j <= n; j++)         if (f[i][j][0])           printf( A );         else           printf( B );       puts(  );     }     return 0;   }   