#include <bits/stdc++.h>

using namespace std;

vector<int> E[200010];
int ans[200010];
map<int, int> S[200010];

int main()
{
	freopen("intouch.in", "r", stdin);
	freopen("intouch.out", "w", stdout);
	int n, m;
	while (scanf("%d%d", &n, &m) != EOF) {
		for (int i = 1; i <= n; i++) {
			E[i].clear();
			ans[i] = 0;
			S[i].clear();
		}
		for (int i = 0; i < m; i++) {
			static char opt[10];
			int u, v;
			scanf("%s", opt);
			if (*opt == '!') {
				scanf("%d", &u);	
				E[u].push_back(i);
			}
			if (*opt == '+') {
				scanf("%d%d", &u, &v);
				if (u == v) continue;
				if (!S[u].count(v)) {
					S[u][v] = S[v][u] = i;
				}
			}
			if (*opt == '-') {		
				scanf("%d%d", &u, &v);
				if (!S[u].count(v)) continue;///
				int last = S[u][v];
				ans[u] += E[v].size() - (lower_bound(E[v].begin(), E[v].end(), last) - E[v].begin());
				ans[v] += E[u].size() - (lower_bound(E[u].begin(), E[u].end(), last) - E[u].begin());
				S[u].erase(v);
				S[v].erase(u);
			}
		}
		
		for (int u = 1; u <= n; u++) {
			for (auto &it : S[u]) {
				int v = it.first;
				int last = it.second;
				ans[u] += E[v].size() - (lower_bound(E[v].begin(), E[v].end(), last) - E[v].begin());
			}
		}
		for (int i = 1; i <= n; i++) {
			if (i > 1) printf(" ");
			printf("%d", ans[i]);
		}
		puts("");
	}
	fclose(stdin);
	fclose(stdout);
	return 0;
}
