#include <bits/stdc++.h>   using namespace std;   int segtree[4 * ((24 * 3600) + 100)], lazy[4 * ((24 * 3600) + 100)];   void propagate(int root, int l, int r) {     segtree[root] += lazy[root];     if (l != r) {       lazy[2 * root + 1] += lazy[root];       lazy[2 * root + 2] += lazy[root];     }     lazy[root] = 0;   }   int query(int root, int l, int r, int a, int b) {     if (b < l || r < a) return 0;     propagate(root, l, r);     if (a <= l && r <= b) return segtree[root];     int mid = (l + r) / 2;     return max(query(2 * root + 1, l, mid, a, b),                query(2 * root + 2, mid + 1, r, a, b));   }   void update(int root, int l, int r, int a, int b, int val) {     if (b < l || r < a) return;     if (a <= l && r <= b) {       lazy[root] += val;       return;     }     int mid = (l + r) / 2;     update(2 * root + 1, l, mid, a, b, val);     update(2 * root + 2, mid + 1, r, a, b, val);     propagate(2 * root + 1, l, mid);     propagate(2 * root + 2, mid + 1, r);     segtree[root] = max(segtree[2 * root + 1], segtree[2 * root + 2]);   }   int n, M, T, h, m, s;   int main() {     scanf( %d %d %d , &n, &M, &T);     vector<int> resp;     int user = 0;     int ult = -1;     for (int i = 0; i < n; i++) {       scanf( %d:%d:%d , &h, &m, &s);       int ini = h * 3600 + m * 60 + s;       int fim = ini + T - 1;       int val = query(0, 0, ((24 * 3600) + 100), ini, fim);       if (val < M) {         user++;         resp.push_back(user);         update(0, 0, ((24 * 3600) + 100), ini, fim, 1);       } else {         update(0, 0, ((24 * 3600) + 100), max(ult + 1, ini), fim, 1);         resp.push_back(user);       }       ult = fim;     }     if (query(0, 0, ((24 * 3600) + 100), 0, ((24 * 3600) + 100)) != M)       printf( No solution n );     else {       printf( %d n , user);       for (int i = 0; i < resp.size(); i++) {         printf( %d n , resp[i]);       }     }   }   