func_code_string: #include <bits/stdc++.h>   using namespace std;   const int INF = (1 << 29);   const int INFF = 0x7fffffff;   const long long LINF = (1ll << 60);   const long long LINFF = 0x7fffffffffffffff;   const long double PI = 3.14159265359;   mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());   long long rnd(long long a, long long b) {     return uniform_int_distribution<long long>(a, b)(rng);   }   int main() {     ios::sync_with_stdio(false);     cin.tie(0);     int t;     cin >> t;     while (t--) {       int n;       cin >> n;       string a, b;       cin >> a >> b;       bool ans = true;       bool change[300][300] = {};       for (int i = 0; i < n; i++) {         if (a[i] != b[i] && a[i] > b[i]) ans = false;         if (a[i] != b[i]) change[a[i]][b[i]] = true;       }       int cnt = 0;       for (int c =  a ; c <=  t ; c++) {         for (int d = c + 1; d <=  t ; d++) {           if (change[c][d] == 0) continue;           cnt += change[c][d];           for (int e = d + 1; e <=  t ; e++) {             change[d][e] += change[c][e];           }           break;         }       }       if (ans == false) cnt = -1;       cout << cnt <<   n ;     }     return 0;   }   