#H2026G. Gap Query

Gap Query

Description

A sequence aa is initially empty. Let nn denote its current length. The following two operations are supported:

  • Append a value to the end of the sequence.
  • Given an index xx, find$$\max_{1 \leq i \leq n,\ i \neq x}\left\lfloor\frac{a_i}{|x-i|}\right\rfloor. $$

If there is no valid index ii (that is, if n=1n=1), the answer is 00.

Input Format

The first line contains one integer mm, the number of operations.

Each of the next mm lines contains two integers opop and xx, describing an operation:

  • If op=1op=1, append the value xx to the end of the sequence.
  • If op=2op=2, query the current sequence using xx as an index. It is guaranteed that 1xn1\leq x\leq n.

Output Format

For each operation with op=2op=2, output the answer on a separate line.

Sample

Input #1

3
1 1
1 2
2 1

Output #1

2

Constraints

For all test cases:

  • 1m1051\leq m\leq 10^5;
  • 0ai1050\leq a_i\leq 10^5;
  • for an operation with op=1op=1, 0x1050\leq x\leq 10^5;
  • for an operation with op=2op=2, 1xn1\leq x\leq n.

The appended values and query indices are generated at random within their respective valid ranges.