import java.util.List; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.Scanner; public class No1705 { private static class KeyValue implements Comparable { public Integer key; public Long value; KeyValue(int key, long value) { this.key = key; this.value = value; } public int compareTo(KeyValue kv) { int n = value.compareTo(kv.value); if (n == 0) { return -key.compareTo(kv.key); } else { return -n; } } } public static void main(String[] args) { Scanner scan = new Scanner(System.in); long N = scan.nextLong(); int M = scan.nextInt(); HashMap hash = new HashMap(); List ary = new ArrayList(); for (int i=0; i < M; i++) { long a = scan.nextLong(); hash.put(i+1, a); ary.add(new KeyValue(i+1, a)); } Collections.sort(ary); int Q = scan.nextInt(); for (int i=0; i < Q; i++) { int t = scan.nextInt(); int x = scan.nextInt(); long y = scan.nextLong(); if (t == 1) { long v = hash.get(x); hash.put(x, v + y); int j = Collections.binarySearch(ary, new KeyValue(x, v)); ary.remove(j); KeyValue kv = new KeyValue(x, v + y); j = Collections.binarySearch(ary, kv); ary.add(-j-1, kv); } else if (t == 2) { long v = hash.get(x); hash.put(x, v - y); int j = Collections.binarySearch(ary, new KeyValue(x, v)); ary.remove(j); KeyValue kv = new KeyValue(x, v - y); j = Collections.binarySearch(ary, kv); ary.add(-j-1, kv); } else { System.out.println(ary.get(0).key); } } } }