n,q=gets.split.map(&:to_i)
s=n.times.map{gets.split.map(&:to_i)}
d=q.times.map{gets.to_i}
a=[]
a += s.flat_map { |e| [ [e[0]-e[2], 0, e[2]] , [e[1]-e[2], 1, e[2]] ] }
a += d.map { |e| [e, 2, 0] }
a.sort_by!{|sb| sb[0]}
x=[]
a.each do |e|
    if e[1]==0
        x << e[2]
    elsif e[1]==1
        x.delete(e[2])
    else
        p x.min || -1
    end
end