Homo or Hetero?

Time limit3sMemory limit256 MB

Problem

You maintain a list of numbers that starts out empty and supports two operations:

  • insert number — appends the given number to the end of the list.
  • delete number — removes the first occurrence of the given number. If the number is not in the list, the list is left unchanged.

For example, inserting $4$ into the list $[1, 2, 1]$ gives $[1, 2, 1, 4]$. Deleting $1$ from $[1, 2, 1, 4]$ gives $[2, 1, 4]$, while deleting $3$ from $[1, 2, 1, 4]$ leaves it unchanged.

A list is homogeneous if it contains at least two equal numbers, and heterogeneous if it contains at least two different numbers. For example, $[2, 2]$ is homogeneous, $[2, 1, 4]$ is heterogeneous, $[1, 2, 1, 4]$ is both, and the empty list is neither.

Starting from the empty list, process a sequence of insert and delete operations and, after each one, report whether the list is homogeneous, heterogeneous, both, or neither.

Input

The first line contains an integer $n$, the number of operations ($1 \le n \le 100,000$).

Each of the next $n$ lines describes one operation: the word insert or delete, followed by an integer $k$ ($-10^9 \le k \le 10^9$).

Output

After each operation, print one line describing the state of the list:

  • both — the list is both homogeneous and heterogeneous.
  • homo — the list is homogeneous but not heterogeneous.
  • hetero — the list is heterogeneous but not homogeneous.
  • neither — the list is neither homogeneous nor heterogeneous.