The first line of input contains two integers $m$ and $n (1≤m,n≤500000)$ denoting the number of producer and consumer companies in the market, respectively. It is followed by $m$ lines, the $i^\texttt{th}$ of which contains two integers $p_i$ and $d_i (1≤p_i,d_i≤10^9)$, the price (in dollars) at which the $i^\texttt{th}$ producer sells one widget and the day on which the first widget will be available from this company. Then follow $n$ lines, the $j^\texttt{th}$ of which contains two integers $q_j$ and $e_j(1≤q_j,e_j≤10^9)$, the price (in dollars) at which the $j^\texttt{th}$ consumer is willing to buy widgets and the day immediately after the day on which the last widget has to be delivered to this company.