/*--------------------------------------------------------------*/
/* 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_fast {
    static BufferedReader in;
    static PrintWriter out;

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

    public void run() throws IOException {
        final int n = Integer.parseInt(in.readLine());

        int size = 0;
        for (int i = 0; i < n; i++) {
            final String line = in.readLine();
            final int index = line.indexOf(' ');
            final String operation = line.substring(0, index);
            final int argument = Integer.parseInt(line.substring(index + 1));
            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 FileReader("homo.in"));
        out = new PrintWriter("homo.out");

        new homo_gk_fast().run();

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