/*--------------------------------------------------------------*/
/* 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                Andrew Stankevich                      */
/*--------------------------------------------------------------*/
 
import java.io.*;
import java.util.HashMap;
import java.util.StringTokenizer;

class homo_as implements Runnable {
    public void solve() throws IOException {
        BufferedReader in = new BufferedReader(new FileReader("homo.in"));
        PrintWriter out = new PrintWriter(new File("homo.out"));

        int n = Integer.parseInt(in.readLine());
        int m = 0;
        HashMap<Integer, Integer> v = new HashMap<Integer, Integer>();
        for (int i = 0; i < n; i++) {
            StringTokenizer st = new StringTokenizer(in.readLine());
            String command = st.nextToken();
            int x = Integer.parseInt(st.nextToken());
            if (command.equals("insert")) {
                if (!v.containsKey(x)) {
                    v.put(x, 0);
                }
                v.put(x, v.get(x) + 1);
                if (v.get(x) == 2) {
                    m++;
                }
            } else {
                if (v.containsKey(x)) {
                    int s = v.get(x);
                    if (s == 1) {
                        v.remove(x);
                    } else {
                        v.put(x, v.get(x) - 1);
                        if (v.get(x) == 1) {
                            m--;
                        }
                    }
                }
            }
            if (v.size() > 1 && m > 0) {
                out.println("both");
            } else if (m > 0) {
                out.println("homo");
            } else if (v.size() > 1) {
                out.println("hetero");
            } else {
                out.println("neither");
            }
        }

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

    public void run() {
        try {
            solve();
        } catch (IOException e) {
            e.printStackTrace();
            throw new AssertionError();
        }
    }

    public static void main(String[] args) {
        new Thread(new homo_as()).start();
    }
}