/*--------------------------------------------------------------*/
/* 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                Georgiy Korneev                        */
/*--------------------------------------------------------------*/
 
import java.util.*;
import java.io.*;

public class homo_gk implements Runnable {
    static Reader in;
    static PrintWriter out;

    private int nextInt() {
        return Integer.parseInt(nextWord());
    }

    private String nextWord() {
        try {
            int ch = in.read();
            while (ch <= ' ') {
                ch = in.read();
            }
            StringBuilder sb = new StringBuilder();
            while (ch > ' ') {
                sb.append((char) ch);
                ch = in.read();
            }
            return sb.toString();
        } catch (IOException e) {
            throw new AssertionError(e);
        }
    }

    final Map<Integer, Integer> elements = new TreeMap<Integer, Integer>();

    public void run() {
        final int n = nextInt();

        int size = 0;
        for (int i = 0; i < n; i++) {
            final String operation = nextWord();
            final int argument = nextInt();
            final int value = getValue(argument);
            final int diff = operation.equals("insert") ? 1 : -1;
            setValue(argument, value + diff);
            if (value > 0 || diff > 0) {
                size += diff;
            }

            boolean homo = elements.size() < size;
            boolean hetero = elements.size() > 1;
            out.println(
                homo 
                    ? (hetero ? "both" : "homo")
                    : (hetero ? "hetero" : "neither")
            );
        }
    }

    public int getValue(int argument) {
        final Integer value = elements.get(argument);
        return value == null ? 0 : value;
    }

    public void setValue(int argument, int value) {
        if (value <= 0) {
            elements.remove(argument);
        } else {
            elements.put(argument, value);
        }
    }


    public static void main(String[] args) throws Exception {        
        in = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);

        new homo_gk().run();

        in.close();
        out.close();
    }
}
