#include using namespace std; using ll = int64_t; #define all(x) ::begin(x), ::end(x) #define debug(x...) [](auto&& ...y){ cerr << "["#x"]:"; ((cerr << ' ' << y), ...) << endl; }(x) int main() { cin.tie(0)->sync_with_stdio(0); int n, m, c; cin >> n >> m >> c; vector> a(n), a2(m); vector b_cnt(n), p_cnt(m); for (int i=0; i> p_cnt[i]; a2[i].resize(p_cnt[i]); for (int& e : a2[i]) { cin >> e; a[--e].push_back(i); b_cnt[e]++; } p_cnt[i] = p_cnt[i] / 2 + 1; } vector rem; for (int i=0; i ans; sort(all(rem)); rem.push_back(n); for (int i=0, j=0; i