#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;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8YWxnb3JpdGhtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKc3RydWN0IEtleSB7CglpbnQgYTsKCWludCBiOwp9OwpLZXkgeFsyMDAwMDBdOwoKaW50IG1haW4oKSB7CglpbnQgbixrLGksaTEsajE9MCxqMj0wLHAscDE9MCxwMj0wLHEsbCxtLHI7CgljaGFyIHNbMTBdOwoJY2luID4+IG47CgljaGFyIHlbbl07IGludCB6W25dOyBpbnQgdVtuXTsKCWZvciAoaT0wOyBpPG47IGkrKykgewoJCWNpbiA+PiBzID4+IGs7CgkJeVtpXT1zWzBdOyB6W2ldPWs7CgkJaWYgKHNbMF09PSdpJykgewoJCQl1W2oxXT1rOyBqMSsrOwoJCX0KCX0KCXNvcnQodSx1K2oxKTsKCW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