#include<bits/stdc++.h>

using namespace std;
const int N = 2e5+5;
int n , m, p[N][3],sz[N][3];
vector<pair<int,int>> checklist;

struct edge{
    int u,v,w;
};
vector<edge> e;

int get(int u,int t){
    if(u != p[u][t]){
        p[u][t] = get(p[u][t],t);

    }
    return p[u][t];
}

bool join(int u,int v,int t){
    u = get(u,t);
    v = get(v,t);
    if(u == v) return false;
    if(sz[u][t] > sz[v][t]) swap(u,v);
    sz[v][t] +=sz[u][t];
    p[u][t] =v;

    return true;
}



int main(){
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cin >> n >> m;
    for(int i=0 ;i <=n;i++) for(int j=1;j<=2;j++) {p[i][j]=i; sz[i][j] =1;};

    for(int i=1;i<=m;i++){
        int x,u,v;
        cin >> x >> u >> v;
        bool check = true;
        join(u,v,x);
        checklist.push_back({u,v});


        for(int j = checklist.size()-1;j >=0;j--){
            u = checklist[j].first; v = checklist[j].second;
            int u1= get(u,1); int v1 = get(v,1);
            int u2 = get(u,2); int v2 = get(v,2);

            if(u1 == v1 && u2 ==v2){
                checklist.pop_back();
            }
            else break;

        }
        if(checklist.size()){
            cout << "No\n";
        }
        else cout << "Yes\n";
    }



}
