#include "bits/stdc++.h" int main() { int N; std::cin >> N; std::vector nums(N); for (int i = 0; i < N; ++i) { std::cin >> nums[i]; } int Q; std::cin >> Q; for (int q = 0; q < Q; ++q) { int s, t, k; std::cin >> s >> t >> k; s--; t--; long long int product = 1; for (int i = s; i <= t; ++i) { product *= nums[i]; product %= k; if (product == 0) { std::cout << "Yes" << std::endl; break; } } if (product != 0) { std::cout << "No" << std::endl; } } return 0; }