This page is still under construction.

Parts of this page are still being built. What you see may change.

Hiring Help

Time limit4sMemory limit1024 MB

Summary
For each consultant request, decide whether the current coders can match its lines and bugs per hour, with coders removed over time.
Level

Hard8 of 10

Topics
Geometry, Divide and conquer
Solved
No attempts yet

Statement

A certain large unnamed software development company has nn developers. The productivity of each coder is measured by two performance indicators: the number of lines of code they write per hour, and the number of bugs they fix per hour.

When a project needs to be done, the manager in charge of the project is allocated a budget of tt man-hours of programmer time. The manager can staff different coders on the project, up to a total of tt hours. For instance, if there are three programmers, the manager can allocate any non-negative real numbers t1t_1, t2t_2, and t3t_3 hours of their respective work hours, as long as t1+t2+t3≤tt_1 + t_2 + t_3 \le t. If the three programmers write l1l_1, l2l_2, and l3l_3 lines of code per hour, a total of t1⋅l1+t2⋅l2+t3⋅l3t_1 \cdot l_1 + t_2 \cdot l_2 + t_3 \cdot l_3 lines of code will be written for the project. Similarly, if they fix b1b_1, b2b_2, and b3b_3 bugs per hour, a total of t1⋅b1+t2⋅b2+t3⋅b3t_1 \cdot b_1 + t_2 \cdot b_2 + t_3 \cdot b_3 bugs will be fixed.

The company has a hiring freeze, so no new coders are hired. A manager may bring in outside help by outsourcing a project to an external consultant, but only if the project cannot be done equally efficiently in-house. If the consultant writes ℓ\ell lines of code and fixes bb bugs in tt hours, and some allocation of the existing coders would write at least ℓ\ell lines of code and fix at least bb bugs in at most tt hours, then the manager is not allowed to hire this consultant. This holds regardless of whether those coders have time for the project or are already busy with other projects.

Employees sometimes quit the company during the freeze. Given a chronological list of events, consultant requests and employees quitting, find out which of the requests will be approved.

Input

The first line contains a single integer nn (0≤n≤2⋅1050 \leq n \leq 2 \cdot 10^5), the number of coders at the start. The coders are numbered from 11 to nn. The next nn lines each contain two integers ℓi\ell_i and fif_i (1≤ℓi,fi≤1081 \leq \ell_i, f_i \leq 10^8), the lines of code and the bugs fixed per hour by coder ii.

The next line contains a single integer ee (1≤e≤1051 \leq e \leq 10^5), the number of events. Each of the following ee lines is one of two forms:

  • "c tt ℓ\ell ff", for integers tt, ℓ\ell, and ff (1≤t≤1001 \leq t \leq 100, 1≤ℓ,f≤1081 \leq \ell, f \leq 10^8): a request to take in a consultant for a project of tt hours, where the consultant would write ℓ\ell lines of code and fix ff bugs in those tt hours.
  • "q ii", for an integer ii (1≤i≤n1 \leq i \leq n): coder ii quit the company.

No coder quits more than once.

Output

For each consultant request, output "yes

Examples2

  1. Example 1

    Input
    4
    200 100
    100 200
    100 100
    200 200
    5
    c 10 2000 2000
    c 5 750 750
    q 4
    c 3 600 600
    c 10 1500 1500
    
    Expected output
    no
    no
    yes
    no
    
  2. Example 2

    Input
    8
    400 300
    300 200
    300 400
    200 300
    500 500
    100 500
    100 100
    500 100
    12
    c 4 1611 1601
    c 3 602 601
    c 2 399 795
    c 1 395 206
    q 7
    q 6
    q 5
    q 4
    c 4 1611 1601
    c 3 602 601
    c 2 399 795
    c 1 395 206
    
    Expected output
    no
    no
    no
    no
    yes
    no
    no
    no