func_code_string: #include <bits/stdc++.h>   using namespace std;   int main() {     int t;     cin >> t;     while (t--) {       int n;       cin >> n;       vector<int> v(n);       vector<int> ans(n);       for (int i = 0; i < n; i++) cin >> v[i];       int flagie = 1;       for (int i = 1; i < n; i++)         if (v[i] != v[i - 1]) flagie = 0;       if (flagie == 1) {         cout << 1 << endl;         for (auto x : ans) cout << 1 <<    ;         cout << endl;       } else {         if (n % 2 == 0) {           ans[0] = 1;           for (int i = 1; i < n; i++) {             ans[i] = 3 - ans[i - 1];           }           cout << 2 << endl;           for (auto x : ans) cout << x <<    ;           cout << endl;         } else {           if (v[0] == v[n - 1]) {             cout << 2 << endl;             ans[0] = 1;             for (int i = 1; i < n; i++) {               ans[i] = 3 - ans[i - 1];             }             for (auto x : ans) cout << x <<    ;             cout << endl;           } else {             int i;             for (i = 0; i < n - 1; i++) {               if (v[i] == v[i + 1]) break;             }             if (i == n - 1) {               ans[0] = 1;               for (int i = 1; i < n; i++) {                 ans[i] = 3 - ans[i - 1];               }               ans[n - 1] = 3;               cout << 3 << endl;               for (auto x : ans) cout << x <<    ;               cout << endl;             } else {               int flag = 1;               ans[0] = 1;               for (int i = 1; i < n; i++) {                 if (v[i] == v[i - 1] && flag == 1) {                   ans[i] = ans[i - 1];                   flag = 0;                 } else {                   ans[i] = 3 - ans[i - 1];                 }               }               cout << 2 << endl;               for (auto x : ans) cout << x <<    ;               cout << endl;             }           }         }       }     }   }   