The Suffering Dwarves

No attempts yetTime limit1sMemory limit512 MB

Problem

Beyond seven hills and seven seas lies a tiny village where $N$ dwarves do nothing but play, eat, and sleep all day long. Fed up with their idleness, Snow White decides to put them through a grueling "gym class" as punishment!

When class begins, the dwarves must line up in a single row ordered from tallest to shortest. Remarkably, no two dwarves share the same height: their heights are exactly $1, 2, \dots, N$ cm. Unfortunately the dwarves are far too dim-witted to compare their own heights and line up on their own, so Snow White controls them with the commands below.

  • 1 X Y — the two dwarves standing at position $X$ and position $Y$ swap places.

Snow White also checks whether a given range of heights is standing together using this command:

  • 2 A B — if the dwarves whose heights are $A, A+1, \dots, B$ cm are all standing next to one another (occupying consecutive positions), print YES; otherwise print NO. They do not have to appear in the order $A, A+1, \dots, B$.

Help the foolish dwarves obey Snow White so that she won't get angry anymore!

Input

The first line contains the number of dwarves $N$ and the number of Snow White's commands $M$ ($2 \le N \le 200,000$, $2 \le M \le 200,000$).

The second line contains $N$ natural numbers describing the dwarves' initial order. This is a permutation in which each height from $1$ to $N$ appears exactly once; the $i$-th number is the height (in cm) of the dwarf standing at position $i$.

Each of the next $M$ lines contains one command, in one of the two forms:

  • 1 X Y ($1 \le X, Y \le N$, $X \ne Y$)
  • 2 A B ($1 \le A \le B \le N$)

Output

For each command of the second form, print its answer as YES or NO, one per line.