#!/usr/bin/env python3 # NOTE: it is recommended to use this even if you don't understand the following code. import sys # uncomment the two following lines if you want to read/write from files # sys.stdin = open('input.txt') # sys.stdout = open('output.txt', 'w') input = sys.stdin.readline # fast input, needed for N and Q up to 500000 N, Q = map(int, input().strip().split()) arr = list(map(int, input().strip().split())) l = [0 for i in range(Q)] r = [0 for i in range(Q)] k = [0 for i in range(Q)] for i in range(Q): l[i], r[i], k[i] = map(int, input().strip().split()) ans = [0 for i in range(Q)] # INSERT YOUR CODE HERE sys.stdout.write("".join(str(ans[i]) + "\n" for i in range(Q))) sys.stdout.close()