''' @author: olivier.massot, 2019 ''' shape = [tuple([int(j) for j in input().split()]) for _ in range(int(input()))] shots = [tuple([int(j) for j in input().split()]) for _ in range(int(input()))] xmin, xmax = min([c[0] for c in shape]), max([c[0] for c in shape]) edges = list(zip(shape[:-1], shape[1:])) + [(shape[-1], shape[0])] oedges = [sorted(e, key=lambda x: x[0]) for e in edges] def is_in(xs, ys): if not xmin <= xs <= xmax: return False fx = [] for start, end in oedges: # vertical edge if start[0] == end[0]: if xs == start[0] and start[1] <= ys <= end[1]: return True else: continue if start[0] <= xs <= end[0]: a = (end[1] - start[1]) / (end[0] - start[0]) b = -1 * a * end[0] + end[1] fx.append(a * xs + b) fx = sorted(list(set(fx))) for y0, y1 in zip(fx[:-1:2], fx[1::2]): if y0 <= ys <= y1: return True return False for s in shots: print("hit" if is_in(*s) else "miss")