#include <bits/stdc++.h> 
using namespace std;
#define mod 1000000007 
#define ll long long int
int main() 
{ 
    #ifndef ONLINE_JUDGE
    freopen("in.txt","r",stdin);
    freopen("out.txt","w",stdout);
    #endif
    ll n,q;
    cin>>n>>q;
    set<pair<ll,ll>>arr,brr;
    map<pair<ll,ll>,char>mp;
    while(q--)
    {
        char c;
        cin>>c;
        if(c=='?')
        {
            ll k;
            cin>>k;
            if(!arr.empty() || (!brr.empty() && k%2==1))
            {
                cout<<"YES\n";
            }
            else
            {
                cout<<"NO\n";
            }
        }
        else if(c=='+')
        {
            ll a,b;
            char ch;
            cin>>a>>b>>ch;
            if(mp.count({b,a}))
            {
                if(mp[{b,a}]==ch)
                {
                    arr.insert({min(a,b),max(a,b)});
                }
                else
                {
                    brr.insert({min(a,b),max(a,b)});
                }
            }
            mp[{a,b}]=ch;
        }
        else
        {
            ll a,b;
            cin>>a>>b;
            if(arr.count({min(a,b),max(a,b)}))
            {
                arr.erase(arr.find({min(a,b),max(a,b)}));
            }
            if(brr.count({min(a,b),max(a,b)}))
            {
                brr.erase(brr.find({min(a,b),max(a,b)}));
            }
            mp.erase(mp.find({a,b}));
        }
    }
    return 0; 
}  