import java.io.*;
import java.util.*;
public class Main{
public static void main(String[] args) throws NumberFormatException, IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int N = Integer.parseInt(br.readLine());
char[] swi = br.readLine().replace(" " , "").toCharArray();
int n = Integer.parseInt(br.readLine());
for (int i = 0; i < n; i++) {
StringTokenizer st = new StringTokenizer(br.readLine(), " ");
int s = Integer.parseInt(st.nextToken());
int k = Integer.parseInt(st.nextToken());
switch(s) {
case 1:
for (int j = k; j <= swi.length; j += k) {
change(j-1, swi);
}
break;
case 2:
k--;
change(k, swi);
int num = (k < Math.abs(swi.length-1 - k) ? k : Math.abs(swi.length - k - 1));
if(k > 0 && k < swi.length - 1) {
for (int j = 1; j <= num; j++) {
if(swi[k - j] == swi[k + j]) {
change(k-j, swi);
change(k+j, swi);
continue;
}else {
break;
}
}
}
}
}
for (int i = 0; i < swi.length; i++) {
System.out.print(swi[i] + " ");
if((i+1) % 20 == 0) {
System.out.println();
}
}
}
static void change(int i, char[] swi) {
if(swi[i]=='1') swi[i] ='0';
else swi[i] = '1';
}
}