You are given a sequence a_1,a_2,…,a_n consisting of positive integers. You have to answer q queries. A query is defined by a triplet of numbers (l,r,x). For each query, you have to find the largest p such that l≤p≤r and a_p is coprime with x, or determine that there is no such p.
The first line of the input contains two integers n and q (1≤n,q≤100,000).
The second line contains n integers a_1,a_2,…,a_n (1≤a_i≤100,000).
The next m lines contain queries. The i-th of these lines contains three integers l_i, r_i and x_i (1≤l_i≤r_i≤n, 1≤x≤100,000).
For each query, output the answer to it on a separate line.