Leopold and Molly both love cake. Leopold loves eating it, and Molly loves watching Leopold eat it. Today they bought N pieces of seed cake. The pieces lie in a row on a narrow plate that has N positions. The positions are numbered 1 to N from left to right, and piece i lies on position i.
Leopold cares about how delicious the pieces are. The initial deliciousness of piece i is di. He starts with piece a, which leaves position a empty. After that he always eats the least delicious piece next to an empty position, so the empty positions always form one closed interval. Molly sometimes puts a topping on a piece to make it more delicious. She always does so in a way that makes the piece one of the 10 most delicious pieces. No two pieces are equally delicious at any time.
Molly sometimes wonders how many pieces Leopold eats before he eats piece b, assuming she adds no further toppings. Write a program that processes instructions of two kinds: make a piece more delicious, and report how many pieces Leopold eats before a given piece.
A query does not actually consume any cake. Each query considers the eating process started again from piece a with the deliciousness values as they stand at that moment.
The first line contains the number of pieces N (1≤N≤250000) and the piece a (1≤a≤N) that Leopold eats first. The second line contains the initial deliciousness values d1,…,dN. They are pairwise distinct and satisfy 1≤di≤N. The third line contains the number of instructions Q (1≤Q≤500000). Each of the next Q lines contains one instruction of one of the two kinds below.
E i e (the character E followed by two integers 1≤i≤N and 1≤e≤10): piece i is enhanced so that it becomes the e-th most delicious piece. The deliciousness order of the other pieces does not change. Before the enhancement, at least e pieces are more delicious than piece i.F b (the character F followed by an integer 1≤b≤N): report how many pieces Leopold eats before he eats piece b.For each F instruction, in the order the instructions appear in the input, print one line with a single integer: the requested number of pieces.