func_code_string: #include <bits/stdc++.h>   using namespace std;   int main() {     int t;     cin >> t;     while (t--) {       int n;       cin >> n;       int a[n + 5];       for (int i = 0; i < n; i++) cin >> a[i];       int ans = 1;       for (int i = 1; i <= 26; i++) {         int x = 1;         while (true) {           int count = 0;           int j, k;           for (j = 0; j < n; j++) {             if (a[j] == i) count++;             if (count == x) break;           }           int count1 = 0;           for (k = n - 1; k >= 0; k--) {             if (a[k] == i) count1++;             if (count1 == x) break;           }           if (j == n || k == -1) break;           if (j >= k) break;           vector<int> freq;           for (int l = 0; l <= 27; l++) freq.push_back(0);           for (int l = j + 1; l < k; l++) freq[a[l]]++;           int y = 0;           for (int l = 0; l <= 26; l++) y = max(y, freq[l]);           ans = max(ans, 2 * x + y);           x++;         }       }       cout << ans <<   n ;     }     return 0;   }   