#include using namespace std; #define fst(t) std::get<0>(t) #define snd(t) std::get<1>(t) #define thd(t) std::get<2>(t) using ll = long long; using P = std::tuple; const int dx[8] = {-1, 1, 0, 0, -1, -1, 1, 1}, dy[8] = {0, 0, -1, 1, -1, 1, -1, 1}; int N, M, Q; P bridges[200000], brokenBridges[200000]; bool isBroken[200000]; int res[100000]; template struct UnionFind2{ UnionFind2(){ init(); } void init(){ for(int i=0;i groups[v].size()){ std::swap(u, v); } for(int w : groups[u]){ members[w] = v; } groups[v].insert(groups[v].end(), groups[u].begin(), groups[u].end()); groups[u].clear(); } bool same(int u, int v){ return members[u] == members[v]; } std::vector groups[n]; // group number of each member int members[n]; }; UnionFind2<100000> uf; int main(){ //* std::cin.tie(nullptr); std::ios::sync_with_stdio(false); /*/ /*/ scanf("%d %d %d", &N, &M, &Q); for(int i=0;i=0;--i){ int u, v; tie(u, v) = brokenBridges[i]; if(!uf.same(0, v)){swap(u, v);} if(!uf.same(0, u) && uf.same(0, v)){ for(int w : uf.groups[uf.members[u]]){ res[w] = i + 1; } } uf.unite(u, v); } for(int i=1;i