Under construction

Still being built. Things may change

Vampire Basketball

Interview

Time limit2sMemory limit1024 MB

Summary
Sort Edward's teammates by a shot favorability score that drops with the defenders within distance l, and print their jersey numbers.
Level

Medium4 of 10

Topics
Sorting, Math, Implementation
Solved
No attempts yet

Hint

The picture shows an example. b1=226⋅4=152b_1 = \frac{2}{26 \cdot 4} = \frac{1}{52}, b2=340⋅3=140b_2 = \frac{3}{40 \cdot 3} = \frac{1}{40}, b3=220⋅4=140b_3 = \frac{2}{20 \cdot 4} = \frac{1}{40}.

Note that the hoop is a point.

Problem

Vampires love sports and are good at them. It is autumn, and playing baseball outside is too chilly, so the vampires decided to play basketball in the gym. As soon as they arrive, they split into two teams. Edward always plays point guard because he likes to make passes. For each lineup, he wants to know which of his teammates are in the most favorable position and which are not.

The court is a half-plane. Every point has integer coordinates xx and yy with y≥0y \ge 0. The hoop is at (0,0)(0, 0). The three-point arc is a semicircle with radius rr centered at the hoop. If a player's distance to the hoop is strictly greater than rr, a made shot is worth three points, otherwise two. Edward knows that all players on his team shoot the same way. Each opponent has a defensive skill, given as a natural number.

Each vampire wears a jersey with a number. Numbers within a team are distinct and consecutive. For example, if Edward's team has three vampires and the opponents have two, their numbers are 1, 2, 3 and 1, 2. Edward wears jersey number 0, and his own position does not matter to him.

Edward rates the favorability of teammate ii with the formula

bi=pidi2⋅(1+∑zj)b_i = \frac{p_i}{d_i^2 \cdot (1 + \sum z_j)}

where pip_i is the number of points a shot from that spot is worth, did_i is the distance from the vampire to the hoop, and ∑zj\sum z_j is the sum of the defensive skills of the opponents whose distance to the attacker does not exceed ll.

To help Edward, print the jersey numbers of his teammates in decreasing order of favorability. If two favorability values are equal, the smaller number comes first.

Input

The first line contains nn, mm, rr, ll (1≤n,m≤1031 \le n, m \le 10^3, 1≤r,l≤1051 \le r, l \le 10^5): the number of vampires on Edward's team, the number of opponents, the radius of the three-point arc, and the distance within which defenders affect players.

The next nn lines contain the coordinates xix_i and yiy_i of Edward's teammates in jersey number order (1≤yi≤1051 \le y_i \le 10^5, −105≤xi≤105-10^5 \le x_i \le 10^5). The next mm lines contain the coordinates xjx_j and yjy_j of the opponents in jersey number order (same bounds), followed by zjz_j (1≤zj≤1001 \le z_j \le 100), the defensive skill of opponent jj.

All player positions are distinct.

Output

Print nn numbers: the jersey numbers of Edward's teammates in the required order.

Examples1

  1. Example 1

    Input
    3 2 6 2
    1 5
    6 2
    -2 4
    5 1 2
    0 4 3
    
    Expected output
    2 3 1