Byteasar runs a skating club. Its members meet regularly to train together, and they always use the club's ice skates. Skate sizes are numbered from 1 to n.
Each member has a foot size, but that alone does not determine which skates they can wear: a skater has a size tolerance d, so a skater whose foot size is r can wear any skate of size from r to r+d. A skater always wears a single pair of skates of the same size, never two different sizes at once.
To stock the club, Byteasar bought k pairs of skates of every size, that is k pairs for each size from 1 to n. Over time some people join the club while others leave, and Byteasar worries whether he will always have enough skates of a suitable size for every current member.
At the start the club has no members. You are given a sequence of m events. Each event means that x members with foot size r have just joined the club (when x≥0) or just left it (when x<0). Immediately after every event, decide whether Byteasar has skates of a suitable size for every member of the club at that moment.
The first line contains four integers n, m, k, and d (1≤n≤200000, 1≤m≤500000, 1≤k≤109, 0≤d<n), separated by single spaces: the largest skate size, the number of events, the number of skate pairs bought of each size, and the size tolerance.
Each of the next m lines describes one event with two integers ri and xi (1≤ri≤n−d, −109≤xi≤109), separated by a single space. If xi≥0, then xi new members with foot size ri have just joined the club; if xi<0, then ∣xi∣ members with foot size ri have just left it. The sequence is always consistent: a member who never joined can never leave.
Print m lines. The i-th line must contain TAK (Polish for yes) if, right after the i-th event, Byteasar has skates of a suitable size for every club member, or NIE (Polish for no) otherwise.
To see how a full assignment can work, suppose that at some moment three members can wear skates of size 1 or 2, two members can wear size 2 or 3, and three members can wear size 3 or 4. Two pairs of skates of each of the sizes 1, 2, 3, and 4 are then enough for everyone: