#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;

struct point_t
{
	int n;
	float x, y;
	point_t(float x, float y, int n) : x(x) , y(y), n(n) {};
	point_t() : x(0), y(0), n(0) {};
};


bool sort_x(const point_t & a, const point_t & b) 
{
	if (a.x == b.x)
		return a.y < b.y;
	return a.x < b.x;
}



bool sort_y(const point_t * a, const point_t * b)
{
	return a->y < b->y;
}

struct advanced_node
{
	float min_x, max_x;
	int leaf_count ;
	vector<point_t *>   y_sorted;
	vector<int> l_index, r_index;
		
	advanced_node * parent;
	advanced_node * left, * right;

	point_t * leaf_data;


	
	void 
	do_merge( const vector<point_t * > & l, const vector<point_t *> & r)
	{
		l_index.reserve(leaf_count+1);
		r_index.reserve(leaf_count+1);
		y_sorted.reserve(leaf_count);

		int lp = 0 , rp = 0;
		for (int p = 0 ; p < leaf_count; ++p) 
		{
			l_index.push_back(lp);
			r_index.push_back(rp);
			if (lp < l.size() && rp < r.size())
			{
				if (l[lp]->y < r[rp]->y)
				{
					y_sorted.push_back(l[lp]);
					lp++;
				}
				else
				{
					y_sorted.push_back(r[rp]);
					rp++;
				}
			}
			else if (lp < l.size())
			{
				y_sorted.push_back(l[lp]);
				lp++;
			}
			else 
			{
				y_sorted.push_back(r[rp]);
				rp++;
			}	
		}
		l_index.push_back(lp);
		r_index.push_back(rp);	
	}


	void 
	add_point(point_t * p)
	{
		leaf_count++;
		y_sorted.push_back(p);
	}	

	advanced_node(float x) :  
					     leaf_count(0) , parent(NULL),
					     left(NULL), right(NULL)
	{
		//y_sorted.push_back(leaf_data);		
		l_index.push_back(0);
		r_index.push_back(0);
		min_x = max_x = x;
	};

	advanced_node(advanced_node * l, advanced_node * r) 
	{
		min_x = min(l->min_x, r->min_x);
		max_x = max(l->max_x, r->max_x);
		
		leaf_count = l->leaf_count + r->leaf_count;
	
		do_merge(l->y_sorted,r->y_sorted);
	
		l->parent = this;
		r->parent = this;
		left = l;
		right = r;

		parent = NULL;	
	};


	pair<int, int>
	binary_obtain(point_t * a, point_t * b)
	{
		vector<point_t *>::iterator lower = lower_bound(y_sorted.begin(), y_sorted.end(), a, sort_y);
		vector<point_t *>::iterator higher = lower_bound(y_sorted.begin(), y_sorted.end(), b, sort_y);
		if (a->y == b->y) {
			higher = upper_bound(y_sorted.begin(), y_sorted.end(), b, sort_y);
		}
		
		int a1 = lower - y_sorted.begin();
		int a2;


		if (higher == y_sorted.end())
			a2 = y_sorted.size();
		else
		 	a2 = higher - y_sorted.begin() ;

		return make_pair(a1,a2);
	}

	pair<int, int>
	binary_obtain_parent(point_t * a, point_t * b, int p1, int p2)
	{
		if (this == parent->left) 
			return make_pair( parent->l_index[p1], parent->l_index[p2]);
		else
			return make_pair( parent->r_index[p1], parent->r_index[p2]);
		

		return binary_obtain(a,b);
	}

	void
	iterate(point_t * a, point_t * b, void (*f)(advanced_node * x, int p1, int p2)  )
	{

		if (a->x > max_x)
			return;
		if (b->x < min_x)
			return;
		
		advanced_node * p = this, * q;
		for (;;) 
		{
			if (!p->left)
				break; // reached leaf
			if ( (a->x <= p->left->max_x) && (b->x <= p->right->min_x) ) 
			{
				p = p->left;
			}
			else if ( (a->x > p->left->max_x) && (b->x > p->right->min_x) )
			{
				p = p->right;
			}
			else if ( (a->x > p->left->max_x) && (b->x <= p->right->min_x) )
				return;
			else
				break;
		}

		pair<int, int> asbab = p->binary_obtain(a, b);

		if (!p->left)
		{
			// if the shakhak is the barg then ghale ghazie ro bekan june ammat
			f(p, asbab.first, asbab.second);
			return;
		}

		vector<pair<int,int> > the_stack;
		the_stack.push_back(asbab);
		//////////////////
		for (q = p; q->left; )
		{
			if (a->x <= q->left->max_x) 
				q = q->left;
			else
				q = q->right;
			the_stack.push_back( q->binary_obtain_parent(a,b, the_stack.back().first, the_stack.back().second));
		}
		f(q,  the_stack.back().first, the_stack.back().second);
		bool left_child;
		for (;;)
		{
			if (q == p)
				break;
			if (q->right && left_child) {
			
				pair<int, int> xx = q->right->binary_obtain_parent(a,b, the_stack.back().first,
							 the_stack.back().second);
				f(q->right, xx.first, xx.second);
			}
			left_child = q->parent->left == q;
			q = q->parent;	
			the_stack.pop_back();
		}

		asbab = p->right->binary_obtain_parent(a,b, asbab.first, asbab.second);
		for (q = p->right; q->left; ) 
		{
			if(b->x <= q->right->min_x)
				q = q->left;
			else
			{
				pair <int,int> xx = q->left->binary_obtain_parent(a,b, asbab.first, asbab.second);
				f(q->left, xx.first, xx.second);
				q = q->right;
			}	
			asbab = q->binary_obtain_parent(a,b, asbab.first, asbab.second);
		}
		f(q, asbab.first, asbab.second);
	}
};

int NUMBER;
vector<int> Q;

void
count_asbab(advanced_node * x, int p1, int p2)
{
	NUMBER += p2 - p1;
}

void
insert_asbab(advanced_node * x, int p1, int p2)
{
	for (int i = p1; i < p2; ++i) 
	{
		Q.push_back(x->y_sorted[i]->n);
	}
}


int
main()
{
	int n , q;
	scanf("%d %d", &n , &q);
	vector<point_t> points;
	points.reserve(n);
	for (int i = 0 ; i < n ; ++i ) 
	{
		float x ,y;
		scanf("%f %f", &x, &y);
		points.push_back(point_t(x,y,i));
	}
	sort(points.begin(), points.end() , sort_x);

	vector<advanced_node *> xha;
	xha.reserve(n);
	for (int i =0; i < n; ++i)
	{
		if (i == 0 || xha.back()->min_x != points[i].x)
			xha.push_back (new advanced_node(points[i].x));
		xha.back()->add_point(&points[i]);	
	}	
	int N = xha.size();
	while (N > 1)
	{
		for (int i = 0 ; i  < N; i+=2)
		{
			if (i +1 < N)
				xha[i/2] = new advanced_node(xha[i], xha[i+1]);
			else
				xha[i/2] = xha[i];
		}
		if (N%2) N++;
		N /= 2;
	}
////////////////
	for (int i =0 ; i < q; ++i)
	{
		int cmd;
		point_t a, b;
		scanf("%d %f %f %f %f", &cmd, &(a.x), &(a.y), &(b.x), &(b.y));
		NUMBER = 0;
		Q.clear();
		
		if (cmd == 0) // count
		{
			xha[0]->iterate(&a, &b, count_asbab);
			printf("%d\n", NUMBER);
		}
		else if (cmd == 1) 
		{
			xha[0]->iterate(&a, &b, insert_asbab);
			printf ("%d", Q.size());
			sort(Q.begin(), Q.end());
			for (int j = 0 ; j < Q.size(); ++j)
			{
				printf(" %d", Q[j]+1);
			}
			printf("\n");
		}
	}
}

