#include <bits/stdc++.h>
#define debug(x) cout << #x << " = " << x << endl
#define REP(i, n) for (Long i = 0; i < (Long)n; i++)
using namespace std;

typedef long long Long;

Long cntBoth = 0;
Long cntEqual = 0;

const int MX = 2e5;
map<Long, char> adj[MX];

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	
	Long n , m;
	cin >> n >> m;
	REP(i , m) {
		char op;
		cin >> op;
		if (op == '?') {
			Long k;
			cin >> k;
			if (cntEqual > 0) cout << "YES\n";
			else if (cntBoth == 0) {
				cout << "NO\n";
			} else if (k % 2 == 1) {
				cout << "YES\n";
			} else {
				cout << "NO\n";
			}
		} else if (op == '+'){
			Long u, v;
			char c;
			cin >> u >> v >> c;
			u--;
			v--;
			adj[u][v] = c;
			if (adj[v].find(u) != adj[v].end()) {
				cntBoth++;
				if (adj[u][v] == adj[v][u]) {
					cntEqual++;
				}
			}
		} else {
			Long u, v;
			cin >> u >> v;
			u--;
			v--;
			if (adj[v].find(u) != adj[v].end()) {
				cntBoth--;
				if (adj[u][v] == adj[v][u]) {
					cntEqual--;
				}
			}
			adj[u].erase(v);
		}
	}
	
	return 0;
}
