The main Bertown street is represented by a straight line. There are 109 bus stops located on the line. The stops are numbered with integers from 1 to 109 in the order in which they follow on the road. The city has n buses. Every day the i-th bus drives from stop number si to stop number fi (si < fi), it stops on all intermediate stops and returns only at night. The bus starts driving at time ti and drives so fast that it finishes driving also at time ti. The time ti is different for all buses. The buses have infinite capacity.

Bertown has m citizens. Today the i-th person should get from stop number li to stop number ri (li < ri); the i-th citizen comes to his initial stop (li) at time bi. Each person, on the one hand, wants to get to the destination point as quickly as possible, and on the other hand, definitely does not want to change the buses as he rides. More formally: the i-th person chooses bus j, with minimum time tj, such that sj ≤ li, ri ≤ fj and bi ≤ tj. 

Your task is to determine for each citizen whether he can ride to the destination point today and if he can, find the number of the bus on which the citizen will ride.

Input

The first line contains two integers n and m (1 ≤ n, m ≤ 105) — the number of buses and the number of people. 

Then n lines follow, each of them contains three integers: si, fi, ti (1 ≤ si, fi, ti ≤ 109, si < fi) — the description of the buses. It is guaranteed that all ti-s are different.

Then m lines follow, each of them contains three integers: li, ri, bi (1 ≤ li, ri, bi ≤ 109, li < ri) — the Bertown citizens' description. Some bi-s could coincide.

Output

In the first line print m space-separated integers: the i-th number should be equal either to -1, if the person number i can't get to the destination point, or to the number of the bus that will ride the person number i. The buses are numbered with integers from 1 to n in the input order.

Examples

Input

4 3
1 10 10
5 6 2
6 7 3
5 7 4
5 7 1
1 2 1
1 10 11


Output

4 1 -1


Input

1 1
1 1000000000 1000000000
1 1000000000 1000000000


Output

1

import java.io.*;
import java.util.*;

public class A{

	static Integer[]busIndices;
	static class query{
		int l,r,v,idx;
		query(int a,int b,int c,int i){
			l=a;
			r=b;
			v=c;
			idx=i;
		}
	}
	public static void main(String[] args) throws IOException {
		Scanner sc=new Scanner();
		PrintWriter out=new PrintWriter(System.out);
		int n=sc.nextInt(),m=sc.nextInt();
		int []s=new int [n],f=new int [n],t=new int [n];
		busIndices=new Integer[n];
		Integer[]sortedbyL=new Integer[n];
		TreeMap<Integer,Integer> map=new TreeMap();
		for(int i=0;i<n;i++) {
			s[i]=sc.nextInt();
			f[i]=sc.nextInt();
			t[i]=sc.nextInt();
			busIndices[i]=i;
			sortedbyL[i]=i;
			map.put(t[i],0);
		}
		int id=n-1;
		for(int x:map.keySet())
			map.put(x, id--);
		id=0;
		Arrays.sort(busIndices, Comparator.comparingInt(i->-t[i]));
		Arrays.sort(sortedbyL, Comparator.comparingInt(i->s[i]));
		query[]queries=new query[m];
		for(int i=0;i<m;i++) {
			queries[i]=new query(sc.nextInt(),sc.nextInt(),sc.nextInt(),i);
		}
		Arrays.sort(queries,(x,y)->x.l-y.l);
		int []ans=new int [m];
		SegmentTree tree=new SegmentTree(n);
		for(query query: queries) {
			int l=query.l,r=query.r;
			while(id<n) {
				int idx=sortedbyL[id];
				if(s[idx]<=l) {
					int segmenttreeIdx=map.get(t[idx]);
					tree.update(segmenttreeIdx,f[idx]);
					id++;
					
				}
				else
					break;
			}
			int lo=0,hi=n-1,right=-1;
			while(lo<=hi) {
				int mid=lo+hi>>1;
				if(t[busIndices[mid]]>=query.v) {
					right=mid;
					lo=mid+1;
				}
				else
					hi=mid-1;
			}
			
			ans[query.idx]=tree.query(0, right, r);
		}
		for(int x:ans)
			out.println(x==-1?-1:x+1);
		out.close();

	}
	static class SegmentTree
	{
		int []max;
		int n;
		SegmentTree(int x){
			n=x;
			max=new int [4*n];
		}
		void update(int idx,int v) {
			update(1,0,n-1,idx,v);
		}
		void update(int node,int tl,int tr,int idx,int v) {
			if(tl==tr)
				max[node]=v;
			else
			{
				int mid=tl+tr>>1,left=node<<1,right=left+1;
				if(idx<=mid)
					update(left,tl,mid,idx,v);
				else
					update(right,mid+1,tr,idx,v);
				max[node]=Math.max(max[left], max[right]);
			}
		}
		// returns the greatest index such that b[i]>=v
		int query(int l,int r,int v) {
			return query(1,0,n-1,l,r,v);
		}
		int query(int node,int tl,int tr,int l,int r,int v) {
			if(r<tl || tr<l || max[node]<v)
				return -1;
			if(tl==tr)
				return busIndices[tl];
			int mid=tl+tr>>1,left=node<<1,right=left+1;
			int x;
			x=query(right,mid+1,tr,l,r,v);
			if(x!=-1)
				return x;
			x=query(left,tl,mid,l,r,v);
			return x;
			}
	}
	static class Scanner
	{
		BufferedReader br;
		StringTokenizer st;
		Scanner(){
			br=new BufferedReader(new InputStreamReader(System.in));
		}
		Scanner(String fileName) throws FileNotFoundException{
			br=new BufferedReader(new FileReader(fileName));
		}
		String next() throws IOException {
			while(st==null || !st.hasMoreTokens())
				st=new StringTokenizer(br.readLine());
			return st.nextToken();
		}
		String nextLine() throws IOException {
			return br.readLine();
		}
		int nextInt() throws IOException{
			return Integer.parseInt(next());
		}
		long nextLong()  throws NumberFormatException, IOException {
			return Long.parseLong(next());
		}
		double nextDouble() throws NumberFormatException, IOException {
			return Double.parseDouble(next());
		}
	}
}
