func_code_string: #include <bits/stdc++.h>   using namespace std;   int n, num, k;   pair<int, int> a[200005];   bool comp(pair<int, int> a, pair<int, int> b) { return a.second < b.second; }   int main() {     ios::sync_with_stdio(0);     cin.tie(NULL);     int t = 1;     cin >> t;     while (t--) {       cin >> n >> k;       unordered_map<int, int> mp;       int color = 1;       for (int i = 0; i < n; i++) {         cin >> a[i].first;         a[i].second = i;       }       sort(a, a + n);       for (int i = 0; i < n; i++) {         mp[a[i].first]++;         if (mp[a[i].first] > k)           a[i].first = 0;         else {           a[i].first = color;           if (color == k)             color = 1;           else             color++;         }       }       color--;       for (int i = n - 1; i >= 0; i--) {         if (a[i].first == color) {           a[i].first = 0;           color--;         }       }       sort(a, a + n, comp);       for (int i = 0; i < n; i++) cout << a[i].first <<    ;       cout << endl;     }     return 0;   }   