/*--------------------------------------------------------------*/
/* ACM ICPC 2009-2010, NEERC                                    */
/* Northern Subregional Contest                                 */
/* St Petersburg, October 17, 2009                              */
/*--------------------------------------------------------------*/
/* Problem H. Homo or Hetero?                                   */
/*                                                              */
/* Original idea         Denis Kuznetsov                        */
/* Problem statement     Georgiy Korneev                        */
/* Testset               Georgiy Korneev                        */
/*--------------------------------------------------------------*/
/* Solution                                                     */
/*                                                              */
/* Author                Sergey Kopeliovich                     */
/*--------------------------------------------------------------*/
 
#include <cstdio>
#include <cstring>

#include <map>
#include <set>

using namespace std;

map <int, int> cnt;
multiset <int> s;

void change( int x, int dx )
{
  if (cnt.count(x))
    s.erase(s.find(cnt[x]));
  else if (dx < 0)
    return;
  cnt[x] += dx;
  if (cnt[x])
    s.insert(cnt[x]);
  else
    cnt.erase(x);
}

int main()
{
  freopen("homo.in", "r", stdin);
  freopen("homo.out", "w", stdout);

  int n;
  scanf("%d", &n);
  while (n--)
  {
    char com[99];
    int x;
    scanf("%s%d", com, &x);
    change(x, com[0] == 'i' ? 1 : -1);

    int hetero = cnt.size() > 1;
    int homo = s.size() && *s.rbegin() > 1;
    static char *res[2][2] = {{"neither", "homo"}, {"hetero", "both"}};
    puts(res[hetero][homo]);
  }
  return 0;
}
