fastle 垆边人似月 皓腕凝霜雪
/*

*/
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<queue>
#include<iostream>
#define f1 first
#define f2 second
#define ll long long
#define mmp make_pair
#define lson l, mid, now << 1
#define rson mid + 1, r, now << 1 | 1
#define ls now << 1
#define rs now << 1 | 1
#define M 100010
using namespace std;
int nm = 0, f = 1;
char c = getchar();
for(; !isdigit(c); c = getchar()) if(c == '-') f = -1;
for(; isdigit(c); c = getchar()) nm = nm * 10 + c - '0';
return nm * f;
}
vector<pair<int, int> > seg[M << 2];

int n, m, t, father[M], sz[M], ans[M], dis[M];
int find(int x) {
return father[x] == x ? x : find(father[x]);
}

int getdis(int x) {
return father[x] == x ? 0 : getdis(father[x]) ^ dis[x];
}
void modify(int l, int r, int now, int ln, int rn, pair<int, int> v) {
if(l > rn || r < ln) return;
if(l >= ln && r <= rn) {
seg[now].push_back(v);
return;
}
int mid = (l + r) >> 1;
modify(lson, ln, rn, v);
modify(rson, ln, rn, v);
}

void work(int l, int r, int now) {
int mid = (l + r) >> 1, f = 0;
vector<pair<int, int> > tmp;
for(int i = 0; i < seg[now].size(); i++) {
int vi = seg[now][i].f1, vj = seg[now][i].f2;
int a = find(vi), b = find(vj);
if(a == b) {
if((getdis(vi) ^ getdis(vj)) == 0) {
f = 1;
break;
}
} else {
if(sz[a] > sz[b]) swap(a, b), swap(vi, vj);
sz[b] += sz[a];
dis[a] = dis[vi] ^ dis[vj] ^ 1;
father[a] = b;
tmp.push_back(mmp(a, b));
}
}
if(!f) {
if(l == r) ans[l] = 1;
else work(lson), work(rson);
}
for(int i = tmp.size() - 1; i >= 0; i--) {
int a = tmp[i].first, b = tmp[i].second;
father[a] = a;
dis[a] = 0;
sz[b] -= sz[a];
}
}
int main() {