#include <iostream>
#include <algorithm>
using namespace std;

struct Key {
	int a;
	int b;
};
Key x[200000];

int main() {
	int n,k,i,i1,j1=0,j2=0,p,p1=0,p2=0,q,l,m,r;
	char s[10];
	cin >> n;
	char y[n]; int z[n]; int u[n];
	for (i=0; i<n; i++) {
		cin >> s >> k;
		y[i]=s[0]; z[i]=k;
		if (s[0]=='i') {
			u[j1]=k; j1++;
		}
	}
	sort(u,u+j1);
	for (i=0; i<j1; i++) {
		if (u[i]!=u[i+1]) {
			x[j2].a=u[i]; j2++;
		}
	}
	for (i=0; i<n; i++) {
		p=0; l=0; r=j2-1;
		while (l<=r && p==0) {
			m=(l+r)/2;
			if (z[i]==x[m].a) {
				i1=m; p=1;
			} else if (z[i]<x[m].a) r=m-1;
			else l=m+1;
		}
		if (p==1) {
			q=x[i1].b;
			if (y[i]=='i') {
				q++;
				if (q==1) p1++;
				if (q==2) p2++;
				x[i1].b=q;
			} else if (q>0) {
				q--;
				if (q==0) p1--;
				if (q==1) p2--;
				x[i1].b=q;
			}
		}
		if (p1>=2 && p2>=1) cout << "both" << endl;
		else if (p1<2 && p2>=1) cout << "homo" << endl;
		else if (p1>=2 && p2<1) cout << "hetero" << endl;
		else cout << "neither" << endl;
	}
	return 0;
}