output_description: For each query, report IDs of points such that sxi ≤ x ≤ txi and syi ≤ y ≤
  tyi. The IDs should be reported in ascending order. Print an ID in a line, and
  print a blank line at the end of output for the each query.
input_description: n
      x0 y0
      x1 y1
      :
      xn-1 yn-1
      q
      sx0 tx0 sy0 ty0
      sx1 tx1 sy1 ty1
      :
      sxq-1 txq-1 syq-1 tyq-1
      
  
  The first integer n is the number of points. In the following n lines, the
  coordinate of the i-th point is given by two integers xi and yi.
  
  The next integer q is the number of queries. In the following q lines, each
  query is given by four integers, sxi, txi, syi, tyi.
attempt: #!/usr/bin/env python
  # -*- coding: utf-8 -*-
  
  from sys import stdin
  from operator import attrgetter
  from collections import namedtuple
  
  
  class Node(object):
      __slots__ = ("location", "left", "right")
  
      def __init__(self):
          self.location = -1
          self.left, self.right = None, None
  
  
  def make2DTree(left, right, depth):
      global np
      if not left < right:
          return None
  
      mid = (left + right) // 2
      cursor = np
      np += 1
  
      if depth % 2 == 0:
          points_list[left:right] = sorted(points_list[left:right], key=attrgetter("x"))
      else:
          points_list[left:right] = sorted(points_list[left:right], key=attrgetter("y"))
  
      node_list[cursor].location = mid
      node_list[cursor].left = make2DTree(left, mid, depth + 1)
      node_list[cursor].right = make2DTree(mid + 1, right, depth + 1)
  
      return cursor
  
  
  def find(v, sx, tx, sy, ty, depth):
      _point = points_list[node_list[v].location]
      x, y, p_index = _point.x, _point.y, _point.i
  
      if (sx <= x <= tx) and (sy <= y <= ty):
          ans.append(p_index)
  
      if depth % 2 == 0:
          if node_list[v].left is not None and sx <= x:
              find(node_list[v].left, sx, tx, sy, ty, depth + 1)
          if node_list[v].right is not None and x <= tx:
              find(node_list[v].right, sx, tx, sy, ty, depth + 1)
      else:
          if node_list[v].left is not None and sy <= y:
              find(node_list[v].left, sx, tx, sy, ty, depth + 1)
          if node_list[v].right is not None and y <= ty:
              find(node_list[v].right, sx, tx, sy, ty, depth + 1)
  
      return None
  
  
  def action():
      global ans
      for area in areas:
          sx, tx, sy, ty = map(int, area)
          find(root, sx, tx, sy, ty, 0)
          print(*sorted(ans), sep="\n")
          print("")
          ans = []
      return None
  
  
  if __name__ == "__main__":
      _input = stdin.readlines()
      points_num = int(_input[0])
      point = namedtuple("Point", "i x y")
      points_list = [
          point(i=index, x=int(each[0]), y=int(each[2]))
          for index, each in enumerate(_input[1 : points_num + 1])
      ]
  
      areas_num = int(_input[points_num + 1])
      areas = map(lambda x: x.split(), _input[points_num + 2 :])
      node_list = [Node() for _ in range(points_num)]
  
      np = 0
      ans = []
      root = make2DTree(0, points_num, 0)
      action()
  
problem_description: Range Search (kD Tree)
  
  The range search problem consists of a set of attributed records S to
  determine which records from S intersect with a given range.
  
  For n points on a plane, report a set of points which are within in a given
  range. Note that you do not need to consider insert and delete operations for
  the set.
samples: [{"input": "6\n    2 1\n    2 2\n    4 2\n    6 2\n    3 3\n    5 4\n    2\n    2 4 0 4\n    4 10 2 5", "output": "0\n    1\n    2\n    4\n    \n    2\n    3\n    5"}]