P17638 [ICPC 2019 Yinchuan R] Pot!!
Description
Little Q is very sleepy, and he really needs some coffee to make him awake. At this time, Little L brings a pot to Little Q, and he states the pot as follows.
For a prime number $p$, if $p^m \mid n$ and $p^{m+1} \nmid n$, we say $\text{pot}_p(n)=m$.
The pot is very special that it can make everyone awake immediately.
Now Little L provides $n~(1 \le n \le 10^5)$ integers $a_1, a_2, \cdots, a_n$ to Little Q, each of which is $1$ initially. After that, Little L shows $2$ types of queries:
* **MULTIPLY l r x**: For every $i \in [l,r]$ ($1\le l\le r\le n$), multiply $a_i$ by $x$ ($2 \le x \le 10$).
* **MAX l r**: Calculate the value of
$$
\max_{l\le i\le r} \left\{ \max_{p|a_i} \left\{ \text{pot}_p (a_i) \right\} \right\}~(1 \le l \le r \le n),
$$
where $p$ is prime.
Now you need to perform $q~(1 \le q \le 10^5)$ queries of these two types of queries described above.
If you perform a “**MULTIPLY**” query, you don't need to output anything.
If you perform a “**MAX**” query, you need to output a line like `ANSWER y`, where $y$ the value you've calculated.
Input Format
The first line contains two integers $n~(1 \le n \le 10^5)$ and $q~(1 \le q \le 10^5)$, the number of integers and the number of queries.
Each of the next $q$ lines contains one type of query described above.
Output Format
For each “**MAX**” query, output one line in the format of `ANSWER y`, where $y$ the value you have calculated.
Explanation/Hint
If $m$ and $n$ are non-zero integers, or more generally, non-zero elements of an integral domain, it is said that $m$ divides $n$ if there exists an integer $k$, or an element $k$ of the integral domain, such that $m \times k=n$, and this is written as $m \mid n$.