Sheets and Paintballs

Given axis-aligned rectangles and colored points, count the distinct color labels that reach each rectangle along the vertical stacking order.

Hard8SortingSegment treeSimulationDFSNo attempts yetTime limit2sMemory limit512 MB

Problem

One day little Donald washed all NN of his white sheets. After washing them he spread them out on the ground in his backyard to dry. No two sheets touch at a corner or along an edge, and no two edges cross, but a smaller sheet may lie entirely on top of a bigger one, and one sheet may cover another one completely. Once the sheets were laid out, Donald went to bed.

Donald's friend Kim heard that the sheets were drying outside and decided to play a trick. In the attic Kim found his father's paintball gun and MM paintballs. The balls come in several colours, and several balls may share the same colour. As soon as Donald fell asleep, Kim walked into the backyard and started shooting at the sheets. Sheets soak up paint, so when the topmost sheet is hit, its colour bleeds down to every sheet lying beneath it. Kim used up all the balls and left in a good mood.

In the morning Donald came out to collect the sheets and found a pile of colours he had never seen. Donald likes exact data and is too shocked to think, so he asks you to count how many new colours ended up on each sheet.

Model the backyard as an infinite coordinate plane, each sheet as a rectangle with sides parallel to the axes, and each shot as a point on that plane. A shot that lands on the boundary of a sheet counts as a hit on that sheet.

A shot may miss every sheet. The coordinates of the shots are pairwise different.

Input

The first line contains the number of sheets NN and the number of paintballs MM. (1N800001 \le N \le 80000, 1M800001 \le M \le 80000)

The ii-th of the next NN lines contains the lower left corner AiA_i, BiB_i and the upper right corner CiC_i, DiD_i of the ii-th sheet. (1Ai<Ci1091 \le A_i < C_i \le 10^9, 1Bi<Di1091 \le B_i < D_i \le 10^9)

The jj-th of the following MM lines contains the coordinates XjX_j, YjY_j where Kim's jj-th shot landed and the colour label KjK_j of that ball. (1Xj1091 \le X_j \le 10^9, 1Yj1091 \le Y_j \le 10^9, 1Kj1091 \le K_j \le 10^9)

Output

Print NN lines. The ii-th line contains the number of new colours on the ii-th sheet.

Hint

In the pictures the number next to a point is the colour label of that shot.

First example

The picture for the first example.

Second example

The picture for the second example.