Increasing or Decreasing

아직 제출이 없습니다시간 제한1초메모리 제한256 MB

문제

You are given two permutations AA and BB of size nn. You want to transform AA to BB in no more than nn operations of the following kind:

  • Choose a subsegment \[l;r]\[l;r] of AA and sort it in either increasing or decreasing order.

Note that you don't have to minimize the number of operations, any sequence of operations of length not more than nn is ok.

입력

The first line contains one integer nn (1n5001 \le n \le 500) --- the sizes of both permutations.

The second line contains the permutation A_1,A_2,,A_nA\_{1}, A\_{2}, \ldots, A\_{n}.

The third line contains the permutation B_1,B_2,,B_nB\_{1}, B\_{2}, \ldots, B\_{n}.

출력

On the first line print one integer mm (0mn0 \le m \le n) --- the number of operations.

On the next mm lines print the descriptions of operation. One description has a form l_il\_{i} r_ir\_{i} t_it\_{i}  (1l_ir_in1 \le l\_{i} \le r\_{i} \le n, t_it\_{i} is 'I' or 'D') and means sort the subsegment \[l_i;r_i]\[l\_{i};r\_{i}] in (I)ncreasing or (D)ecreasing order.

If there are different solutions any one will be accepted. It is guaranteed that there is at least one solution.