import sys

victims = sys.stdin.readline().strip()
days = int(sys.stdin.readline().strip())

for day in range(days):
  print(victims)
  newVictims = sys.stdin.readline().strip().split()
  victims = victims.replace(newVictims[0], newVictims[1], 1)

print(victims)


import sys

victims = sys.stdin.readline().strip().split()
days = int(sys.stdin.readline().strip())

for day in range(days):
  print(victims[0] + ' ' + victims[1])
  newPeople = sys.stdin.readline().strip().split()
  killed = newPeople[0]
  replacer = newPeople[1]

  if victims[0] == killed:
    victims[0] = replacer
  elif victims[1] == killed:
    victims[1] = replacer

print(victims[0] + ' ' + victims[1])


R = lambda: raw_input().split()

victims = R()
n = input()
for vic in victims:
    print vic,
print
for i in range(n):
    new_vic = R()
    if victims[0] == new_vic[0]:
        victims[0] = new_vic[1]
    else:
        victims[1] = new_vic[1]
    for vic in victims:
        print vic,
    print


li = raw_input().split()
n = int(raw_input())
print li[0],li[1]
for i in range(n):
    a,b = raw_input().split()
    li.remove(a)
    li.append(b)
    print li[0],li[1]


n1,n2 = raw_input().split()

x = input()

print n1,n2

for i in range(x):
    x,y = raw_input().split()
    if x == n1:
        print y,n2
        n1 = y

    else:
        print y,n1
        n2 = y


ans = raw_input().split()
n = input()
print " ".join(ans)
for i in range(n):
	x = raw_input().split()
	ans[ans.index(x[0])] = x[1]
	print (ans[0], ans[1])


ans = raw_input().split()
n = input()
print " ".join(ans)
for i in range(n):
	x = raw_input().split()
	ans[ans.index(x[0])] = x[1]
	print " ".join(ans)


s=raw_input

a,b=s().split()

print a,b

n=input()

for i in range(n):
    c,d=s().split()
    if c == a:
        a = d
    else:
        b = d
    print a,b


a,b = raw_input().split()
n = int(input())
arr = [a,b]
print(" ".join(arr))
for i in range(n):
	a,b = raw_input().split()
	if arr[0]==a:
		arr[0] = b
	elif arr[1]==a:
		arr[1] = b
	print(" ".join(arr))


intial_name = set(raw_input().split())
print ' '.join(intial_name)
for _ in xrange(int(raw_input())):
    temp = set(raw_input().split())
    intial_name = intial_name ^ temp
    print ' '.join(intial_name)


x = raw_input().strip().split()
n = int(raw_input().strip())
print ' '.join(x)
for i in xrange(n):
    y = raw_input().strip().split()
    if x[0] == y[0]:
        x[0] = y[1]
    else:
        x[1] = y[1]
    print ' '.join(x)


x,y=raw_input().split()
n=int(raw_input())
for i in range(n):
	print x,y
	z,a=raw_input().split()
	if z==x:
		x,a=a,x
	else:
		y,a=a,y
print x,y


x,y=raw_input().split()
n=int(raw_input())
for i in range(n):
	print x,y
	z,a=raw_input().split()
	if z==x:
		x,a=a,x
	else:
		y,a=a,y


a=raw_input().split()
print" ".join(a)
for _ in range(input()):
    x=raw_input().split()
    a[a.index(x[0])]=x[1]
    print" ".join(a)


name1, name2 = raw_input().split()
n = input()
print name1, name2
for i in xrange(n):
    a, b = raw_input().split()
    if a == name1:
        print name2, b
        name1 = b
    else:
        print name1, b
        name2 = b


import itertools
from fractions import gcd
from math import sqrt
from bisect import bisect_left
import heapq
from collections import deque
from itertools import combinations as C

def Ls():
	return list(raw_input())
def get(a):
	return map(a , raw_input().split())
def Int():
	return int(raw_input())
def Str():
	return raw_input()
from collections import defaultdict , deque

#Time to rise :)
har = raw_input().split()
n = input()
print ' '.join(har)
for i in xrange(n):
	ai , bi = raw_input().split()
	har.remove(ai)
	har.append(bi)
	print ' '.join(har)


live = []
die = []
x, y = raw_input().split()
live.append(x)
live.append(y)
print x,
print y
n = input()
while n > 0:
	n = n - 1
	x, y = raw_input().split()
	die.append(x)
	live.append(y)
	tot = 0
	for li in live:
		if li not in die:
			print li,
			tot = tot + 1
		if tot == 2:
			print ""
			break


s= str(input())
ans=s + "\n"
for i in range(int(input())):
    x= str(input())
    y= x.split( )[0]

    if s.split( )[0]==y:
        ans=ans+ x.split( )[1]+ " "
        ans= ans + s.split( )[1]+"\n"
        s= x.split( )[1] + " " + s.split( )[1]
    else:
        ans= ans+ x.split( )[1]+" "
        ans= ans+ s.split( )[0]+"\n"
        s= x.split( )[1]+" "+s.split( )[0]
print(ans.strip())


s1, s2 = input().split()
n = int(input())
for i in range(n):
    print(s1, s2)
    t1, t2 = input().split()
    if s1 == t1:
        s1 = t2
    elif s1 == t2:
        s1 = t1
    elif s2 == t1:
        s2 = t2
    else:
        s2 = t1
print(s1, s2)


s = list(map(str, input().split()))
print(*s)
for cas in range(int(input())):
    t = list(map(str, input().split()))
    if s[0] == t[0]:
        s[0] = t[1]
    elif s[0] == t[1]:
        s[0] = t[0]
    elif s[1] == t[0]:
        s[1] = t[1]
    else:
        s[1] = t[0]
    print(*s)


a,b=input().split()
print(a,b)
for _ in range(int(input())):
         x,y=input().split()
         if(x==a):
                  a=y
         else:
                  b=y
         print(a,b)


name1, name2 = input().lower().split(' ')
print(name1+" "+name2)
n = int(input())
i = 0
while i < n:
    victim1, victim2 = input().lower().split(' ')
    if name1 == victim1:
        name1 = victim2
    elif name2 == victim1:
        name2 = victim2
    print(name1+" "+name2)
    i+=1
# ross rachel
# 4
# ross joey
# rachel phoebe
# phoebe monica
# monica chandler

# icm codeforces
# 1
# codeforces technex


t = list(input().split())
print(*t)
for _ in range(int(input())):
    s = list(input().split())
    t.remove(s[0])
    t.append(s[1])
    print(*t)


x,y = list(map(str,input().split()))
print(x,y)
n = int(input())
for i in range(n):
	a,b = list(map(str,input().split()))
	if a==x:
		x = b
		print(x,y)
	elif a==y:
		y = b
		print(x,y)
	elif b==x:
		x=a
		print(x,y)
	elif b==y:
		y = a
		print(x,y)


def main():
    first, second = map(str, input().split())
    print(first, second)
    n = int(input())
    while n > 0:
        n -= 1
        killed, replaced = map(str, input().split())
        if killed == first:
            first = replaced
        else:
            second = replaced
        print(first, second)

if __name__ == '__main__':
    main()


a, b = input().split()
n = int(input())
print(a, b)
for i in range(n):
	kill, ptn = input().split()
	if (kill == a):
		a = ptn
	else:
		b = ptn
	print(a, b)


a,b=map(str,input().split())
n=int(input())
murdered=[]
replaced=[]
for i in range(n):
    m,s=map(str,input().split())
    murdered.append(m)
    replaced.append(s)
l1=[a,b]
print(" ".join(l1))
for i in range(n):
    if murdered[i]==l1[0]:
        l1.remove(l1[0])
        l1.append(replaced[i])
        print(" ".join(l1))
    elif murdered[i]==l1[1]:
        l1.remove(l1[1])
        l1.append(replaced[i])
        print(" ".join(l1))


n,m=input().split()
k=int(input())
l=[]
l.append([n,m])
for _ in range(k):
    a,b=input().split()
    if a==n:
        n=b
    elif a==m:
        m=b
    l.append([n,m])
for i in l:
    print(*i)


l=[str(i) for i in input().split()]
n=int(input())
print(*l)
for i in range(n):
    a=[str(i) for i in input().split()]
    if(a[0]==l[0]):
        l[0]=a[1]
    else:
        l[1]=a[1]
    print(*l)


n,m=map(str,input().split());s,k=n,m;print(s,k)
for i in range(int(input())):
    q,w=map(str,input().split())
    if s==q:s=w;print(s,k)
    else:k=w;print(s,k)


n,m=map(str,input().split());s,k=n,m;print(s,k)
for i in range(int(input())):
    q,w=map(str,input().split())
    if s==q:s,k=w,q;print(s,k)
    else:k=w;print(s,k)


l=list(input().split());print(*l)
for _ in range(int(input())):m,n=input().split();l[l.index(m)]=n;print(*l)


ans = input().split()
n = int(input())
print(*ans)
for _ in range(n):
  names = input().split()
  for i in range(2):
    if ans[i] == names[0]:
      ans[i] = names[1]
  print(*ans)


victims = input().split()
print(" ".join(victims))
n = int(input())
for i in range(n):
    killed, replaced = input().split()
    if victims[0] == killed:
        victims[0] = replaced
    else:
        victims[1] = replaced
    print(" ".join(victims))


def solution():
    candidates = set(input().split())
    days = int(input())

    print(*candidates)

    for day in range(days):
        candidates ^= set(input().split())
        print(*candidates)

def main():
    solution()

if __name__ == '__main__':
    main()


def main():
    a, b = input().split()
    n = int(input())
    print(a, b)
    for _ in range(n):
        x, y = input().split()
        if x == a:
            a = y
        else:
            b = y
        print(a, b)

if __name__ == '__main__':
    main()


import math as mt
import sys,string,bisect
input=sys.stdin.readline
from collections import deque,defaultdict
L=lambda : list(map(int,input().split()))
Ls=lambda : list(input().split())
M=lambda : map(int,input().split())
I=lambda :int(input())
a,b=input().split()
print(a,b)
n=I()
for i in range(n):
    k=input().split()
    if(a==k[0]):
        a=k[1]
    else:
        b=k[1]
    print(a,b)


text = input().split()
print(*text)
for i in range(int(input())):
    a, b = input().split()

    text.remove(a)

    text.append(b)
    print(*text)


a,b=map(str,input().split())
n=int(input())
print(a,b)
for i in range(n+1):
 ai,bi=map(str,input().split())
 if(a==ai):
  a=bi
 else:
  b=bi
 print(a,b)


s = input().split()
for i in range(int(input())):
	print(s[0], s[1])
	s1 = input().split()
	s[s.index(s1[0])] = s1[1]

print(s[0], s[1])


v1, v2 = input().split()
n = int(input())
print(v1, v2)
for i in range(n):
    dead, tv1 = input().split()
    if dead == v1:
        print(v2, tv1)
        v1 = tv1
    else:
        print(v1, tv1)
        v2 = tv1


l=input().split()
print(*l)
n=int(input())
for i in range(n):
  m,n=input().split()
  l[l.index(m)]=n
  print(*l)


from sys import stdin

name1, name2 = [x.strip() for x in input().split()]
n = int(input())
print(name1, name2)
d = {name1, name2}
for i in range(n):
    n1, n2 = [x.strip() for x in input().split()]
    d.discard(n1)
    d.add(n2)
    ans = ' '.join(d)
    print(ans)


#!/usr/bin/env pypy3
# -*- coding: UTF-8 -*-

a,b=input().split()
print(a,b)
n=int(input())
l=[a,b]
for i in range(n):
    a,b=input().split()
    if a==l[0]:
        l[0]=b
    else:
        l[1]=b
    print(*l)


e = input().split()
print(*e)
n = int(input())
for x in range(n):
    x=input().split()
    e[e.index(x[0])]=x[1]
    print(*e)


a, b = map(str, input().split())
q = int(input())
print(a, b)
for i in range(q):
    x, y = map(str, input().split())
    if a == x:
        a = y
    else:
        b = y
    print(a, b)


s = list(input().split())
print(*s)
n = int(input())
for i in range(n):
    x = list(input().split())
    s[s.index(x[0])] = x[1]
    print(*s)


R = lambda:map(int,input().split())

arr = input().split()
print(*arr)
n, = R()
for i in range(n):
    x, y = input().split()
    arr[arr.index(x)] = y
    print(*arr)


a, b = input().split()
n = int(input())
last = (a, b)
print(a, b)
for i in range(n):
    s = input().split()
    x = 1 - last.index(s[0])
    last = (last[x], s[1])
    print(last[0], last[1], sep = " ")


x,y=input().split();a=[];p=[x,y]
a.append(x+' '+y)
for i in range(int(input())):
	m,n=input().split()
	if m in p:
		p[p.index(m)]=n
	else:
		p[p.index(n)]=m
	a.append(p[0]+' '+p[1])
for i in a:
	print(i)


x,y=input().split();a=[];p=x+' '+y
a.append(p)
for i in range(int(input())):
	m,n=input().split()
	if m in p:p=p.replace(m,n)
	else:p=p.replace(n,m)
	a.append(p)
for i in a:
	print(i)


a = input().split()

n = int(input())

for i in range(n):
	print(' '.join(a))
	ki, p = input().split()
	if a[0] == ki:
		a[0] = p
	else:
		a[1] = p

print(' '.join(a))


n = int(input())
a = list(map(int, input().split()))

s = set([])
w = n

def echo():
	global w

	res = []
	i = w
	while i in s:
		res.append(i)
		s.remove(i)
		i -= 1
	w = i
	print(' '.join(map(str, res)))

for i in a:
	s.add(i)
	if i == w:
		echo()
	else:
		print()


f, s = input().split()
print(f, s)
n = int(input())

for _ in range(n):
  killed, new = input().split()
  if killed == f:
    f = new
    print(f, s)
  else:
    s = new
    print(f, s)


s=input()
l=[s]
n=int(input())
for i in range(n):
    x,y=map(str,input().split())
    if(x in s):
        s=s.replace(x,y)
        l.append(s)
for i in l:
    print(i)


s=input()
l=[s]
n=int(input())
for i in range(n):
    x,y=map(str,input().split())
    if(x in s):
        s=s.replace(x,y)
        l.append(s)
    else:
        s=s.replace(y,x)
        l.append(s)
for i in l:
    print(i)


s=list(input().split())
print(*s)
n=int(input())
for i in range(n):
    ss=list(input().split())
    s.remove(ss[0])
    s.append(ss[1])
    print(*s)


import sys,math
from collections import deque
#input = sys.stdin.buffer.readline

def solve():
	return;

# for _ in range(int(input())):
# 	solve()

[a,b] = input().split()

n = int(input())

for i in range(n):
	print(a,b)
	[x,y] = input().split()
	if x==a:
		a = y
	else:
		b = y

print(a,b)


import sys
import math
import bisect
import itertools

def main():
    ans = []
    A = input().split()
    ans.append(A.copy())
    n = int(input())
    for i in range(n):
        s, t = input().split()
        A.remove(s)
        A.append(t)
        ans.append(A.copy())
    for i in range(len(ans)):
        print(' '.join(ans[i]))

if __name__ == "__main__":
    main()


a, b = input().split()
n = int(input())
ans = [(a, b)] + [list() for i in range(n)]
for i in range(1, n + 1):
    a, b = input().split()
    ans[i] = ans[i - 1][1 if ans[i - 1][0] == a else 0], b
[print(*i) for i in ans]


l = list(map(str,input().split()))
n = int(input())
for i in l:
    print(i, end = " ")
print("")
for i in range(n):
    ll = list(map(str,input().split()))

    if(l[0] == ll[0]):
        l[0] = ll[1]
    else:
        l[1] = ll[1]

    for j in l:
        print(j, end = " ")
    print('')


n,m= input().split()
print(n,m)
num = int(input())
for i in range(num):
	a,b=input().split()
	if(a==n):
		print(b,m)
		n=b
	else:
		print(b,n)
		m=b


victim1, victim2 = input().split()
print(victim1, victim2)
for _ in range(int(input())):
    killed, replacement = input().split()
    if victim1 == killed:
        victim1 = replacement
    else:
        victim2 = replacement
    print(victim1, victim2)


from sys import stdin,stdout,maxsize;# mod = int(1e9 + 7);#import re  # can use multiple splits
tup = lambda: map(int, stdin.readline().split())
I = lambda: int(stdin.readline())
lint = lambda: [int(x) for x in stdin.readline().split()]
#S = lambda: stdin.readline().replace('\n', '').strip()
#def grid(r, c): return [lint() for i in range(r)]
#def debug(*args, c=6): print('\033[3{}m'.format(c), *args, '\033[0m', file=stderr)
stpr = lambda x  : stdout.write(f'{x}' + '\n')
star = lambda x : print(' '.join(map(str , x)))
a , b = input().split()
print(a , b)
for _ in range(I()):
    c , d = input().split()
    if c==a:
        a = d
    else:
        b = d
    print(a , b)


a = [i for i in input().split()]
n = int(input())

for x in range(n):
	print(a[0],a[1])
	b = [j for j in input().split()]
	if b[0] == a[0]:
		a[0] = b[1]
	else:
		a[1] = b[1]

print(a[0],a[1])


from math import *
from collections import deque
from copy import deepcopy
import sys
def inp(): return sys.stdin.readline().rstrip("\r\n") #for fast input
def multi(): return map(int,input().split())
def strmulti(): return map(str, inp().split())
def lis(): return list(map(int, inp().split()))
def lcm(a,b): return (a*b)//gcd(a,b)
def ncr(n,r): return factorial(n) // (factorial(r) * factorial(max(n - r, 1)))
def stringlis(): return list(map(str, inp().split()))
def out(var): sys.stdout.write(str(var))  #for fast output, always take string
def printlist(a) :
    print(' '.join(str(a[i]) for i in range(len(a))))

def isPrime(n) :
    if (n <= 1) : return False
    if (n <= 3) : return True
    if (n % 2 == 0 or n % 3 == 0) : return False
    i = 5
    while(i * i <= n) :
        if (n % i == 0 or n % (i + 2) == 0) :
            return False
        i = i + 6
    return True

#copied functions end

#start coding

a=stringlis()
n=int(input())
print(a[0],a[1])
for i in range(n):
    temp=stringlis()
    if(temp[0]==a[0]):
        a[0]=temp[1]
    else:
        a[1]=temp[1]
    print(a[0],a[1])


t=list(input().split())
print(*t)
for k in range(int(input())):
    s=list(input().split())

    t.remove(s[0])
    t.append(s[1])

    print(*t)


init = input()
print(init)
init = init.split()
t = int(input())
for x in range(t):

    init+=input().split()
    for y in init:
        if init.count(y)==2:
            init.remove(y)
            init.remove(y)
    print(*init)


name = []
name.append(input().split())
n = int(input())
for i in range (n):
    p1, p2 = input().split()
    if name[i][0] == p1:
        name.append([p2, name[i][1]])
    else:
        name.append([name[i][0], p2])
for n in name:
    print(n[0], n[1])


v1, v2 = map(str, input().split())
t = int(input())
print(v1,v2)
for i in range(t):
    k, r = map(str,input().split())
    if(k == v1):
        v1 = r
        print(v1,v2)
    else:
        v2 = r
        print(v1,v2)


a, b = input().split()
n = int(input())

print(a, b)
for i in range(n):
	kill, ptn = input().split()
	if (kill == a):
		a = ptn
	else:
		b = ptn
	print(a, b)


from sys import *
from math import *
b=list(input().split())
n=int(input())
m=[]
for i in range(n):
    a=list(input().split())
    m.append(a)
print(*b)
for i in range(n):
    if m[i][0]==b[0]:
        b[0]=m[i][1]
    else:
        b[1]=m[i][1]
    print(*b)


s1,s2 = input().split()

n = int(input())
for i in range(n):
    print(s1,s2)
    s,c = input().split()
    if s == s1:
        s1 = c
    else:
        s2 = c
print(s1,s2)


#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <cstring>
#include <vector>
#include <string>
#define N 10001
using namespace std;

int main()
{
	int seq[N];
	int aug[N];

	int n, m;
	while(scanf("%d %d", &n, &m) == 2)
	{
		for(int i = 0; i < n; ++ i)
		{
			scanf("%d", seq + i);
			aug[i] = 0;
		}

		int n_type_2 = 0;
		for (int i  = 0; i < m; ++ i)
		{
			int op_type;
			scanf("%d", &op_type);
			int tp;
			switch (op_type)
			{
				case 1:
					int v, x;
					scanf("%d %d",&v, &x);
					aug[v-1] = -n_type_2;
					seq[v-1] = x;
					break;
				case 2:
					scanf("%d", &tp);
					n_type_2 += tp;
					break;
				case 3:
					scanf("%d", &tp);
					printf("%d\n", seq[tp-1] + n_type_2+aug[tp -1] );
			}
		}
	}
	return 0;
}


#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <cstring>
#include <vector>
#include <string>
#define N 10001
using namespace std;

int main()
{
	int seq[N];

	int n, m;
	while(scanf("%d %d", &n, &m) == 2)
	{
		for(int i = 0; i < n; ++ i)
			scanf("%d", seq + i);
		int n_type_2 = 0;
		for (int i  = 0; i < m; ++ i)
		{
			int op_type;
			scanf("%d", &op_type);
			int tp;
			switch (op_type)
			{
				case 1:
					int v, x;
					scanf("%d %d",&v, &x);
					seq[v-1] = x;
					break;
				case 2:

					scanf("%d", &tp);
					for (int i  =0; i < n; i ++)
						{seq[i] += tp;}
					//n_type_2 += tp;
					break;
				case 3:

					scanf("%d", &tp);
					printf("%d\n", seq[tp-1] );
			}
		}
	}
	return 0;
}


#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <cstring>
#include <vector>
#include <string>
#define N 10001
using namespace std;

int main()
{
	int seq[N];

	int n, m;
	while(scanf("%d %d", &n, &m) == 2)
	{
		for(int i = 0; i < n; ++ i)
			scanf("%d", seq + i);
		int n_type_2 = 0;
		for (int i  = 0; i < m; ++ i)
		{
			int op_type;
			scanf("%d", &op_type);
			int tp;
			switch (op_type)
			{
				case 1:
					int v, x;
					scanf("%d %d",&v, &x);
					if (n_type_2)
					{
						for (int i = 0; i < n; ++ i)
							seq[i] += n_type_2;
					}
					n_type_2 = 0;
					seq[v-1] = x;

					break;
				case 2:
					scanf("%d", &tp);
					n_type_2 += tp;
					break;
				case 3:

					scanf("%d", &tp);
					printf("%d\n", seq[tp-1] + n_type_2 );
			}
		}
	}
	return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#define N 10001

using namespace std;

int main()
{
	int seq[N];

	int n, m;
	while(scanf("%d %d", &n, &m) == 2)
	{
		for(int i = 0; i < n; ++ i)
			scanf("%d", seq + i);

		int n_type_2 = 0;
		int tp, v, x;
		while(m --)
		{
			int op_type;
			scanf("%d", &op_type);
			switch (op_type)
			{
				case 1:
					scanf("%d %d",&v, &x);
					seq[v-1] = x-n_type_2;
					break;
				case 2:
					scanf("%d", &tp);
					n_type_2 += tp;
					break;
				case 3:
					scanf("%d", &tp);
					printf("%d\n", seq[tp-1] + n_type_2);
			}
		}
	}
	return 0;
}


#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <cstring>
#include <vector>
#include <string>
#define N 10001
using namespace std;

int main()
{
	int seq[N];
	int n, m;
	while(scanf("%d %d", &n, &m) == 2)
	{
		for(int i = 0; i < n; ++ i)
			scanf("%d", seq + i);
		long long n_type_2 = 0;
		for (int i  = 0; i < m; ++ i)
		{
			int op_type;
			scanf("%d", &op_type);
			int tp;
			switch (op_type)
			{
				case 1:
					int v, x;
					scanf("%d %d",&v, &x);
					seq[v-1] = x;
					break;
				case 2:

					scanf("%d", &tp);
					n_type_2 += tp;
					break;
				case 3:

					scanf("%d", &tp);
					printf("%I64d\n", seq[tp-1] + n_type_2);
			}
		}
	}
	return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#define N 100001

using namespace std;

int main()
{
	long long seq[N];

	int n, m;
	while(scanf("%d %d", &n, &m) == 2)
	{
		for(int i = 0; i < n; ++ i)
			scanf("%I64d", seq + i);

		long long n_type_2 = 0;
		int tp, v, x;
		while(m --)
		{
			int op_type;
			scanf("%d", &op_type);
			switch (op_type)
			{
				case 1:
					scanf("%d %d",&v, &x);
					seq[v-1] = x-n_type_2;
					break;
				case 2:
					scanf("%d", &tp);
					n_type_2 += tp;
					break;
				case 3:
					scanf("%d", &tp);
					printf("%I64d\n", seq[tp-1] + n_type_2);
			}
		}
	}
	return 0;
}


#include<stdio.h>
#define sc(n) scanf("%ld",&n)
#define sc1(n,m) scanf("%ld%ld",&n,&m)
int main()
{
    long m,n,i,j,x,y,t,p=0;
    sc1(m,n);
    long a[m];
    for(i=0;i<m;i++)
    sc(a[i]);
    for(i=0;i<n;i++)
    {
        sc(t);
        if(t==1)
        {
            sc1(x,y);
            a[x-1]=y;
        }
        else if(t==2)
        {
            sc(x);
            p+=x;
        }
        else
        {
            sc(x);
            printf("%ld\n",a[x-1]);
        }
    }
}


/*********************************************
*              sohel ahmed.                  *
*      computer acience & engineering.       *
*      Islamic  University Bangladesh.       *
*                                            *
*********************************************/
#include<iostream>
#include<cstring>
#include<cmath>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<deque>
#include<map>
#include<queue>
#include<stack>
#include<cstdlib>
#define pi 3.14159
#define loop(n) for(int i=0;i<n;i++)
#define loop1(n) for(int i=1;i<=n;i++)
#define vin vector<int>
#define pb(a) push_back(a)
using namespace std;
int main()
{
    vector<int>v;
    long m,n,i,j,x,y,t,p;
    cin>>m>>n;
    long a[m];
    for(i=0;i<m;i++)
    cin>>a[i];
    long b[n],c[n];
    for(i=0;i<n;i++)
    {
        cin>>t;
        if(t==1)
        {
            cin>>x>>y;
            a[x-1]=y;
        }
        else if(t==2)
        {
            cin>>x;
            for(j=0;j<m;j++)
            a[j]+=x;
        }
        else
        {
            cin>>x;
            cout<<a[x-1]<<endl;
        }
    }
    p=v.size();
    for(i=0;i<p;i++)
    cout<<a[p+1]<<endl;
}


#include<stdio.h>
int main()
{
    long m,n,i,j,x,y,t,p;
    scanf("%ld%ld",&m,&n);
    long a[m];
    for(i=0;i<m;i++)
    scanf("%ld",&a[i]);
    for(i=0;i<n;i++)
    {
        scanf("%ld",&t);
        if(t==1)
        {
            scanf("%ld%ld",&x,&y);
            a[x-1]=y;
        }
        else if(t==2)
        {
            scanf("%ld",&x);
            for(j=0;j<m;j++)
            a[j]+=x;
        }
        else
        {
            scanf("%ld",&x);
            printf("%ld\n",a[x-1]);
        }
    }
}


/*********************************************
*              sohel ahmed.                  *
*      computer acience & engineering.       *
*      Islamic  University Bangladesh.       *
*                                            *
*********************************************/
#include<iostream>
#include<cstring>
#include<cmath>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<deque>
#include<map>
#include<queue>
#include<stack>
#include<cstdlib>
#define pi 3.14159
#define loop(n) for(int i=0;i<n;i++)
#define loop1(n) for(int i=1;i<=n;i++)
#define vin vector<int>
#define pb(a) push_back(a)
using namespace std;
int main()
{
    int a,b,i,n,m=0;
    cin>>n;
    for(i=0;i<n;i++)
    {
        cin>>a>>b;
        if(a==b)
        m++;
    }
    cout<<m<<endl;
}


#include<iostream>
#include<stdio.h>
using namespace std;
int main()
{
    //freopen("n.txt","r",stdin);
    //freopen("m.txt","w",stdout);
    long m,n,i,t,q=0,x,y;
    cin>>m>>n;
    long a[m];
    for(i=0;i<m;i++)
    cin>>a[i];
    for(i=0;i<n;i++)
    {
        cin>>t;
        if(t==1)
        {
            cin>>x>>y;
            a[x-1]=y-q;
        }
        else if(t==2)
        {
            cin>>x;
            q+=x;
        }
        else
        {
            cin>>x;
            cout<<a[x-1]+q<<endl;
        }
    }
}


#include<iostream>
using namespace std;
int main()
{
    long m,n,i,t,q=0,x,y;
    cin>>m>>n;
    long a[m];
    for(i=0;i<m;i++)
    cin>>a[i];
    for(i=0;i<n;i++)
    {
        cin>>t;
        if(t==1)
        {
            cin>>x>>y;
            a[x-1]=y;
        }
        else if(t==2)
        {
            cin>>x;
            q+=x;
        }
        else
        {
            cin>>x;
            cout<<a[x-1]+q<<endl;
        }
    }
}


#include<stdio.h>
#define sc(n) scanf("%ld",&n)
#define sc1(n,m) scanf("%ld%ld",&n,&m)
int main()
{
    long m,n,i,j,x,y,t,p=0;
    sc1(m,n);
    long a[m];
    for(i=0;i<m;i++)
    sc(a[i]);
    for(i=0;i<n;i++)
    {
        sc(t);
        if(t==1)
        {
            sc1(x,y);
            a[x-1]=y;
        }
        else if(t==2)
        {
            sc(x);
            p+=x;
        }
        else
        {
            sc(x);
            printf("%ld\n",a[x-1]+p);
        }
    }
}


/*********************************************
*              sohel ahmed.                  *
*      computer acience & engineering.       *
*      Islamic  University Bangladesh.       *
*                                            *
*********************************************/
#include<iostream>
#include<cstring>
#include<cmath>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<deque>
#include<map>
#include<queue>
#include<stack>
#include<cstdlib>
#define pi 3.14159
#define loop(n) for(int i=0;i<n;i++)
#define loop1(n) for(int i=1;i<=n;i++)
#define vin vector<int>
#define pb(a) push_back(a)
int main()
{
    long m,n,i,j,x,y,t,p;
    scanf("%ld%ld",&m,&n);
    long a[m];
    for(i=0;i<m;i++)
    scanf("%ld",&a[i]);
    for(i=0;i<n;i++)
    {
        scanf("%ld",&t);
        if(t==1)
        {
            scanf("%ld%ld",&x,&y);
            a[x-1]=y;
        }
        else if(t==2)
        {
            scanf("%ld",&x);
            for(j=0;j<m;j++)
            a[j]+=x;
        }
        else
        {
            scanf("%ld",&x);
            printf("%ld\n",a[x-1]);
        }
    }
}


#include<iostream>
using namespace std;
int main()
{
long int n,m,i,j,a[100009],t,k;
cin>>n>>m;
for(i=1;i<=n;i++)
{
cin>>a[i];
}
int s=0;
for(i=0;i<m;i++)
{
cin>>t;
if(t==3)
{
cin>>j;
cout<<a[j]+s<<"\n";
}
else if(t==2)
{
cin>>k;
s+=k;
}
else
{
cin>>j>>k;
a[j]=k-s;
}
}
return 0;
}


#include<stdio.h>
#define sc(n) scanf("%ld",&n)
#define sc1(n,m) scanf("%ld%ld",&n,&m)
int main()
{
    long m,n,i,j,x,y,t,p;
    sc1(m,n);
    long a[m];
    for(i=0;i<m;i++)
    sc(a[i]);
    for(i=0;i<n;i++)
    {
        sc(t);
        if(t==1)
        {
            sc1(x,y);
            a[x-1]=y;
        }
        else if(t==2)
        {
            sc(x);
            for(j=0;j<m;j++)
            a[j]+=x;
        }
        else
        {
            sc(x);
            printf("%ld\n",a[x-1]);
        }
    }
}


#include<stdio.h>
#define sc(n) scanf("%ld",&n)
#define sc1(n,m) scanf("%ld%ld",&n,&m)
int main()
{
    long m,n,i,j,x,y,t,q=0;
    sc1(m,n);
    long a[m];
    for(i=0;i<m;i++)
    sc(a[i]);
    for(i=0;i<n;i++)
    {
        sc(t);
        if(t==1)
        {
            sc1(x,y);
            a[x-1]=y;
        }
        else if(t==2)
        {
            sc(x);
            p+=x;
        }
        else
        {
            sc(x);
            printf("%ld\n",a[x-1]+q);
        }
    }
}


/*********************************************
*              sohel ahmed.                  *
*      computer acience & engineering.       *
*      Islamic  University Bangladesh.       *
*                                            *
*********************************************/
#include<iostream>
#include<cstring>
#include<cmath>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<deque>
#include<map>
#include<queue>
#include<stack>
#include<cstdlib>
#define pi 3.14159
#define loop(n) for(int i=0;i<n;i++)
#define loop1(n) for(int i=1;i<=n;i++)
#define vin vector<int>
#define pb(a) push_back(a)
using namespace std;
int main()
{
    vector<int>v;
    long m,n,i,j,x,y,t,p;
    cin>>m>>n;
    long a[m];
    for(i=0;i<m;i++)
    cin>>a[i];
    for(i=0;i<n;i++)
    {
        cin>>t;
        if(t==1)
        {
            cin>>x>>y;
            a[x-1]=y;
        }
        else if(t==2)
        {
            cin>>x;
            for(j=0;j<m;j++)
            a[j]+=x;
        }
        else
        {
            cin>>x;
            cout<<a[x-1]<<endl;
        }
    }
}


#include<stdio.h>
#include<iostream>
//#include<iostream>
using namespace std;
int main()
{
int n,m,i,p=0,j;
scanf("%d%d",&n,&m);
int arr[n],ar[m],a[m],x,b,c,d,e;
for(i=0;i<n;i++)
{
scanf("%d",&arr[i]);
}
for(j=0;j<m;j++)
{
scanf("%d",&x);
  if(x==1)
  {
   scanf("%d%d",&b,&c);
   arr[b-1]=c;
  }
  else if(x==2)
  {
      scanf("%d",&d);
      for(i=0;i<n;i++)
      {
          arr[i]=arr[i]+d;
      }
  }
  else if(x==3)
  {
      scanf("%d",&e);
      a[p]=arr[e-1];
      cout<<a[p]<<"\n";p++;
  }
}/*
for(i=0;i<p;i++)
{
    printf("%d\n",a[i]);
}*/
return 0;
}


#include<stdio.h>
#include<iostream>
//#include<iostream>
using namespace std;
int main()
{
int n,m,i,p=0,j;
scanf("%d%d",&n,&m);
int arr[n],ar[m],a[m],x,b,c,d,e;
for(i=0;i<n;i++)
{
scanf("%d",&arr[i]);
}
for(j=0;j<m;j++)
{
scanf("%d",&x);
  if(x==1)
  {
   scanf("%d%d",&b,&c);
   arr[b]=c;
  }
  else if(x==2)
  {
      scanf("%d",&d);
      for(i=0;i<n;i++)
      {
          arr[i]=arr[i]+d;
      }
  }
  else if(x==3)
  {
      scanf("%d",&e);
      a[p]=arr[e-1];
      p++;
  }
}
for(i=0;i<p;i++)
{
    printf("%d\n",a[i]);
}
return 0;
}


#include<stdio.h>
#include<iostream>
//#include<iostream>
using namespace std;
int main()
{
int n,m,i,p=0,j;
scanf("%d%d",&n,&m);
int arr[n],ar[m],a[m],x,b,c,d,e;
for(i=0;i<n;i++)
{
scanf("%d",&arr[i]);
}
int val=0;
for(j=0;j<m;j++)
{
scanf("%d",&x);
  if(x==1)
  {
   scanf("%d%d",&b,&c);
   arr[b-1]=c-val;
  }
  else if(x==2)
  {
      scanf("%d",&d);
    //  for(i=0;i<n;i++)
      {
          //arr[i]=arr[i]+d;
          val=val+d;
      }
  }
  else if(x==3)
  {
      scanf("%d",&e);
      //a[p]=arr[e-1];
      cout<<arr[e-1]+val<<"\n";p++;
  }
}/*
for(i=0;i<p;i++)
{
    printf("%d\n",a[i]);
}*/
return 0;
}


#include<stdio.h>
#include<iostream>
//#include<iostream>
using namespace std;
int main()
{
int n,m,i,p=0,j;
scanf("%d%d",&n,&m);
int arr[n],ar[m],a[m],x,b,c,d,e;
for(i=0;i<n;i++)
{
scanf("%d",&arr[i]);
}
for(j=0;j<m;j++)
{
scanf("%d",&x);
  if(x==1)
  {
   scanf("%d%d",&b,&c);
   arr[b]=c;
  }
  else if(x==2)
  {
      scanf("%d",&d);
      for(i=0;i<n;i++)
      {
          arr[i]=arr[i]+d;
      }
  }
  else if(x==3)
  {
      scanf("%d",&e);
      a[p]=arr[e];
      p++;
  }
}
for(i=0;i<p;i++)
{
    printf("%d\n",a[i]);
}
return 0;
}


#include<stdio.h>
#include<iostream>
//#include<iostream>
using namespace std;
int main()
{
int n,m,i,p=0,j;
scanf("%d%d",&n,&m);
int arr[n],ar[m],a[m],x,b,c,d,e;
for(i=0;i<n;i++)
{
scanf("%d",&arr[i]);
}
for(j=0;j<m;j++)
{
scanf("%d",&x);
  if(x==1)
  {
   scanf("%d%d",&b,&c);
   arr[b-1]=c;
  }
  else if(x==2)
  {
      scanf("%d",&d);
      for(i=0;i<n;i++)
      {
          arr[i]=arr[i]+d;
      }
  }
  else if(x==3)
  {
      scanf("%d",&e);
      a[p]=arr[e-1];
      p++;
  }
}
for(i=0;i<p;i++)
{
    printf("%d\n",a[i]);
}
return 0;
}


#include<stdio.h>
#include<iostream>
//#include<iostream>
using namespace std;
int main()
{
int n,m,i,p=0,j;
scanf("%d%d",&n,&m);
int arr[n],ar[m],a[m],x,b,c,d,e;
for(i=0;i<n;i++)
{
scanf("%d",&arr[i]);
}
int val=0;
for(j=0;j<m;j++)
{
scanf("%d",&x);
  if(x==1)
  {
   scanf("%d%d",&b,&c);
   arr[b-1]=c-val;
  }
  else if(x==2)
  {
      scanf("%d",&d);
      for(i=0;i<n;i++)
      {
          //arr[i]=arr[i]+d;
          val=val+d;
      }
  }
  else if(x==3)
  {
      scanf("%d",&e);
      a[p]=arr[e-1];
      cout<<a[p]+val<<"\n";p++;
  }
}/*
for(i=0;i<p;i++)
{
    printf("%d\n",a[i]);
}*/
return 0;
}


#include<stdio.h>
#include<iostream>
//#include<iostream>
using namespace std;
int main()
{
int n,m,i,p=0,j;
scanf("%d%d",&n,&m);
int arr[n],ar[m],a[m],x,b,c,d,e;
for(i=0;i<n;i++)
{
scanf("%d",&arr[i]);
}
for(j=0;j<m;j++)
{
scanf("%d",&x);
  if(x==1)
  {
   scanf("%d%d",&b,&c);
   arr[b-1]=c;
  }
  else if(x==2)
  {
      scanf("%d",&d);
      for(i=0;i<n;i++)
      {
          arr[i]=arr[i]+d;
      }
  }
  else if(x==3)
  {
      scanf("%d",&e);
      a[p]=arr[e-1];
      p++;
      cout<<a[p]<<"\n";
  }
}/*
for(i=0;i<p;i++)
{
    printf("%d\n",a[i]);
}*/
return 0;
}


#include<stdio.h>
#include<iostream>
//#include<iostream>
using namespace std;
int main()
{
int n,m,i,p=0,j;
scanf("%d%d",&n,&m);
int arr[n],ar[m],a[m],x,b,c,d,e;
for(i=0;i<n;i++)
{
scanf("%d",&arr[i]);
}
int val=0;
for(j=0;j<m;j++)
{
scanf("%d",&x);
  if(x==1)
  {
   scanf("%d%d",&b,&c);
   arr[b-1]=c;//-val;
  }
  else if(x==2)
  {
      scanf("%d",&d);
    //  for(i=0;i<n;i++)
      {
          //arr[i]=arr[i]+d;
          val=val+d;
      }
  }
  else if(x==3)
  {
      scanf("%d",&e);
      //a[p]=arr[e-1];
      cout<<arr[e-1]+val<<"\n";p++;
  }
}/*
for(i=0;i<p;i++)
{
    printf("%d\n",a[i]);
}*/
return 0;
}


#include<stdio.h>
#include<iostream>
//#include<iostream>
using namespace std;
int main()
{
int n,m,i,p=0,j;
scanf("%d%d",&n,&m);
int arr[n],ar[m],a[m],x,b,c,d,e;
for(i=0;i<n;i++)
{
scanf("%d",&arr[i]);
}
int val=0;
for(j=0;j<m;j++)
{
scanf("%d",&x);
  if(x==1)
  {
   scanf("%d%d",&b,&c);
   arr[b-1]=c-val;
  }
  else if(x==2)
  {
      scanf("%d",&d);
      for(i=0;i<n;i++)
      {
          //arr[i]=arr[i]+d;
          val=val+d;
      }
  }
  else if(x==3)
  {
      scanf("%d",&e);
      //a[p]=arr[e-1];
      cout<<arr[e-1]+val<<"\n";p++;
  }
}/*
for(i=0;i<p;i++)
{
    printf("%d\n",a[i]);
}*/
return 0;
}


#include<stdio.h>
#include<iostream>
//#include<iostream>
using namespace std;
int main()
{
int n,m,i,p=0,j;
scanf("%d%d",&n,&m);
int arr[n],ar[m],a[m],x,b,c,d,e;
for(i=0;i<n;i++)
{
scanf("%d",&arr[i]);
}
int val=0;
for(j=0;j<m;j++)
{
scanf("%d",&x);
  if(x==1)
  {
   scanf("%d%d",&b,&c);
   arr[b-1]=c;
  }
  else if(x==2)
  {
      scanf("%d",&d);
      for(i=0;i<n;i++)
      {
          //arr[i]=arr[i]+d;
          val=val+d;
      }
  }
  else if(x==3)
  {
      scanf("%d",&e);
      a[p]=arr[e-1];
      cout<<a[p]+val<<"\n";p++;
  }
}/*
for(i=0;i<p;i++)
{
    printf("%d\n",a[i]);
}*/
return 0;
}


#include<stdio.h>
#include<iostream>
//#include<iostream>
using namespace std;
int main()
{
int n,m,i,p=0,j;
scanf("%d%d",&n,&m);
int arr[n],ar[m],a[m],x,b,c,d,e;
for(i=0;i<n;i++)
{
scanf("%d",&arr[i]);
}
int val=0;
for(j=0;j<m;j++)
{
scanf("%d",&x);
  if(x==1)
  {
   scanf("%d%d",&b,&c);
   arr[b-1]=c-val;
  }

  else if(x==2)
  {
      scanf("%d",&d);
    //  for(i=0;i<n;i++)
      {
          //arr[i]=arr[i]+d;
          val=val+d;
      }
  }
  else if(x==3)
  {
      scanf("%d",&e);
      //a[p]=arr[e-1];
      cout<<arr[e-1]+val<<"\n";p++;
  }
}/*
for(i=0;i<p;i++)
{
    printf("%d\n",a[i]);
}*/
return 0;
}


#include <iostream>
#include <fstream>
#include <cstdio>
#include <climits>
#include <vector>
#include <map>
#include <list>
#include <deque>
#include <stack>
#include <set>
#include <string>
#include <cstring>
#include <algorithm>
#include <bitset>
#include <cmath>

using namespace std;

#define LL long long

int main()
{
	vector<int> values(100001);
	int n,m,temp,temp1;
	cin>>n>>m;
	for(int i=0;i<n;i++)
	{
		scanf("%d",&temp);
		values[i] = temp;
	}
	LL sum=0;
	for(int i=0;i<m;i++)
	{
		scanf("%d",&temp);
		if(temp==1)
		{
			scanf("%d %d",&temp,&temp1);
			values[temp-1]=sum-temp1;
		}
		else if(temp==2)
		{
			scanf("%d",&temp);
			sum += temp;
		}
		else
		{
			scanf("%d",&temp);
			printf("%d\n",values[temp-1]+sum);
		}
	}
	return 0;
}


#include <iostream>
#include <fstream>
#include <cstdio>
#include <climits>
#include <vector>
#include <map>
#include <list>
#include <deque>
#include <stack>
#include <set>
#include <string>
#include <cstring>
#include <algorithm>
#include <bitset>
#include <cmath>

using namespace std;

#define LL long long

int main()
{
	vector<int> values(100001);
	int n,m,temp,temp1;
	cin>>n>>m;
	for(int i=0;i<n;i++)
	{
		scanf("%d",&temp);
		values[i] = temp;
	}
	LL sum=0;
	for(int i=0;i<m;i++)
	{
		scanf("%d",&temp);
		if(temp==1)
		{
			scanf("%d %d",&temp,&temp1);
			values[temp-1]=temp1-sum;
		}
		else if(temp==2)
		{
			scanf("%d",&temp);
			sum += temp;
		}
		else
		{
			scanf("%d",&temp);
			printf("%d\n",values[temp-1]+sum);
		}
	}
	return 0;
}


#include <iostream>
#include <fstream>
#include <cstdio>
#include <climits>
#include <vector>
#include <map>
#include <list>
#include <deque>
#include <stack>
#include <set>
#include <string>
#include <cstring>
#include <algorithm>
#include <bitset>
#include <cmath>

using namespace std;

#define LL long long

int main()
{
	vector<int> values(100001);
	int n,m,temp,temp1;
	cin>>n>>m;
	for(int i=0;i<n;i++)
	{
		scanf("%d",&temp);
		values[i] = temp;
	}
	for(int i=0;i<m;i++)
	{
		scanf("%d",&temp);
		if(temp==1)
		{
			scanf("%d %d",&temp,&temp1);
			values[temp-1]=temp1;
		}
		else if(temp==2)
		{
			scanf("%d",&temp);
			for(int i=0;i<n;i++)
			{
				values[i]+=temp;
			}
		}
		else
		{
			scanf("%d",&temp);
			printf("%d\n",values[temp-1]);
		}
	}
	return 0;
}


#include <iostream>
#include <fstream>
#include <cstdio>
#include <climits>
#include <vector>
#include <map>
#include <list>
#include <deque>
#include <stack>
#include <set>
#include <string>
#include <cstring>
#include <algorithm>
#include <bitset>
#include <cmath>

using namespace std;

#define LL long long

int main()
{
	vector<int> values(100001);
	int n,m,temp,temp1;
	cin>>n>>m;
	for(int i=0;i<n;i++)
	{
		cin>>temp;
		values[i] = temp;
	}
	for(int i=0;i<m;i++)
	{
		cin>>temp;
		if(temp==1)
		{
			cin>>temp>>temp1;
			values[temp-1]=temp1;
		}
		else if(temp==2)
		{
			cin>>temp;
			for(int i=0;i<n;i++)
			{
				values[i]+=temp;
			}
		}
		else
		{
			cin>>temp;
			cout << values[temp-1] << endl;
		}
	}
	return 0;
}


#include <iostream>
#include <fstream>
#include <cstdio>
#include <climits>
#include <vector>
#include <map>
#include <list>
#include <deque>
#include <stack>
#include <set>
#include <string>
#include <cstring>
#include <algorithm>
#include <bitset>
#include <cmath>

using namespace std;

#define LL long long

int main()
{
	map<int,int> values;
	int n,m,temp,temp1;
	cin>>n>>m;
	for(int i=0;i<n;i++)
	{
		cin>>temp;
		values[i] = temp;
	}
	for(int i=0;i<m;i++)
	{
		cin>>temp;
		if(temp==1)
		{
			cin>>temp>>temp1;
			values[temp-1]=temp1;
		}
		else if(temp==2)
		{
			cin>>temp;
			for(map<int,int>::iterator it=values.begin();it!=values.end();it++)
			{
				(*it).second = (*it).second+temp;
			}
		}
		else
		{
			cin>>temp;
			cout << values[temp-1] << endl;
		}
	}
	return 0;
}


#include <iostream>
#include <vector>
#include <string>
#include <string.h>
#include <cstring>
#include <cmath>
#include <queue>
#include <stack>
#include <algorithm>
#include <map>
#include <stdio.h>
#include <stdlib.h>
using namespace std;

int main()
{
    int T,Q;

    cin >>T>>Q;
    int go=0;
    vector<int> a;
    int temp;
    for (int i=0 ; i< T ; i++)
    {
        cin>>temp;
        a.push_back(temp);
    }
    int ope, val;
    for (int i =0 ; i < Q ; i++)
    {
        cin>>ope>>val;
        if (ope==3)
        {
            cout<<a[val-1]+go<<endl;
        }
        else if (ope==2)
        {
            go+=val;
        }
        else if (ope==1)
        {
            cin>>temp;
            a[val-1]=temp;
        }
    }
    return 0;
}


#include <iostream>
#include <vector>
#include <string>
#include <string.h>
#include <cstring>
#include <cmath>
#include <queue>
#include <stack>
#include <algorithm>
#include <map>
#include <stdio.h>
#include <stdlib.h>
using namespace std;

long long arr[100001];
int main()
{
    int T,Q;

    cin >>T>>Q;
    long long go=0;
    vector<long long> a(T);
    memset(arr,0,sizeof(arr));
    long long temp;
    for (int i=0 ; i< T ; i++)
    {
        cin>>temp;
        a[i]=temp;
    }
    long long ope, val;

    for (int i =0 ; i < Q ; i++)
    {
        cin>>ope>>val;
        //ope=2; val=10000;
        if (ope==3)
        {
            cout<<a[val-1]+(go-arr[val-1])<<endl;
        }
        else if (ope==2)
        {
            go+=val;
        }
        else if (ope==1)
        {
            cin>>temp;
            a[val-1]=temp;
            arr[val-1]=go;
        }
    }
    return 0;
}


#include <iostream>
#include <vector>
#include <string>
#include <string.h>
#include <cstring>
#include <cmath>
#include <queue>
#include <stack>
#include <algorithm>
#include <map>
#include <stdio.h>
#include <stdlib.h>
using namespace std;

long long arr[10001];
int main()
{
    int T,Q;

    cin >>T>>Q;
    long long go=0;
    vector<long long> a;
    memset(arr,0,sizeof(arr));
    int temp;
    for (int i=0 ; i< T ; i++)
    {
        cin>>temp;
        a.push_back(temp);
    }
    long long ope, val;

    for (int i =0 ; i < Q ; i++)
    {
        cin>>ope>>val;
        if (ope==3)
        {
            cout<<a[val-1]+go-arr[val-1]<<endl;
        }
        else if (ope==2)
        {
            go+=val;
        }
        else if (ope==1)
        {
            cin>>temp;
            a[val-1]=temp;
            arr[val-1]=go;
        }
    }
    return 0;
}


#include <iostream>
#include <vector>
#include <string>
#include <string.h>
#include <cstring>
#include <cmath>
#include <queue>
#include <stack>
#include <algorithm>
#include <map>
#include <stdio.h>
#include <stdlib.h>
using namespace std;

int arr[10001];
int main()
{
    int T,Q;

    cin >>T>>Q;
    int go=0;
    vector<int> a;
    memset(arr,0,sizeof(arr));
    int temp;
    for (int i=0 ; i< T ; i++)
    {
        cin>>temp;
        a.push_back(temp);
    }
    int ope, val;
    for (int i =0 ; i < Q ; i++)
    {
        cin>>ope>>val;
        if (ope==3)
        {
            cout<<a[val-1]+go-arr[val-1]<<"---"<<endl;
        }
        else if (ope==2)
        {
            go+=val;
        }
        else if (ope==1)
        {
            cin>>temp;
            a[val-1]=temp;
            arr[val-1]=go;
        }
    }
    return 0;
}


#include <iostream>
#include <vector>
#include <string>
#include <string.h>
#include <cstring>
#include <cmath>
#include <queue>
#include <stack>
#include <algorithm>
#include <map>
#include <stdio.h>
#include <stdlib.h>
using namespace std;

int arr[10001];
int main()
{
    int T,Q;

    cin >>T>>Q;
    int go=0;
    vector<int> a;
    memset(arr,0,sizeof(arr));
    int temp;
    for (int i=0 ; i< T ; i++)
    {
        cin>>temp;
        a.push_back(temp);
    }
    int ope, val;
    for (int i =0 ; i < Q ; i++)
    {
        cin>>ope>>val;
        if (ope==3)
        {
            cout<<a[val-1]+go-arr[val-1]<<endl;
        }
        else if (ope==2)
        {
            go+=val;
        }
        else if (ope==1)
        {
            cin>>temp;
            a[val-1]=temp;
            arr[val-1]=go;
        }
    }
    return 0;
}


#include <iostream>
#include <vector>
#include <string>
#include <string.h>
#include <cstring>
#include <cmath>
#include <queue>
#include <stack>
#include <algorithm>
#include <map>
#include <stdio.h>
#include <stdlib.h>
using namespace std;

long long arr[10001];
int main()
{
    int T,Q;

    cin >>T>>Q;
    long long go=0;
    vector<long long> a(T);
    memset(arr,0,sizeof(arr));
    long long temp;
    for (int i=0 ; i< T ; i++)
    {
        cin>>temp;
        a[i]=temp;
    }
    long long ope, val;

    for (int i =0 ; i < Q ; i++)
    {
        cin>>ope>>val;
        //ope=2; val=10000;
        if (ope==3)
        {
            cout<<a[val-1]+(go-arr[val-1])<<endl;
        }
        else if (ope==2)
        {
            go+=val;
        }
        else if (ope==1)
        {
            cin>>temp;
            a[val-1]=temp;
            arr[val-1]=go;
        }
    }
    return 0;
}


#include <iostream>
#include <string.h>
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <vector>
#include <map>
#define F first
#define S second
#define ll long long

using namespace std;

int main()
{
//freopen("i.txt","r",stdin);
long long n,m ,a[1000000]={},b[1000000]={},y=0;
cin>>n>>m;
for(int i=1; i<=n; i++)
    cin>>a[i];
for(int i=0; i<m; i++)
{
    int t;
    cin>>t;
    if(t==1)
    {
        int v,x;
        cin>>v>>x;
        b[v]=x;
    }
    if(t==2)
    {
        int x;
        cin>>x;
        y+=x;
    }
    if(t==3)
    {
        int q;
        cin>>q;
        cout<<a[q]+b[q]+y<<endl;
    }
}

return 0;
}


#include <iostream>
#include <string.h>
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <vector>
#include <map>
#define F first
#define S second
#define ll long long

using namespace std;

int main()
{
//freopen("i.txt","r",stdin);
long long n,m ,a[100000]={},b[100000]={},y=0;
cin>>n>>m;
for(int i=1; i<=n; i++)
    cin>>a[i];
for(int i=0; i<m; i++)
{
    int t;
    cin>>t;
    if(t==1)
    {
        int v,x;
        cin>>v>>x;
        a[v]=x-y;

    }
    if(t==2)
    {
        int x;
        cin>>x;
        y+=x;
    }
    if(t==3)
    {
        int q;
        cin>>q;
        cout<<a[q]+y<<endl;
    }
}

return 0;
}


#include <iostream>
#include <string.h>
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <vector>
#include <map>
#define F first
#define S second
#define ll long long

using namespace std;

int main()
{
//freopen("i.txt","r",stdin);
long long n,m ,a[1000000]={},b[1000000]={},y=0;
cin>>n>>m;
for(int i=1; i<=n; i++)
    cin>>a[i];
for(int i=0; i<m; i++)
{
    int t;
    cin>>t;
    if(t==1)
    {
        int v,x;
        cin>>v>>x;
        b[v]+=x;
    }
    if(t==2)
    {
        int x;
        cin>>x;
        y+=x;
    }
    if(t==3)
    {
        int q;
        cin>>q;
        cout<<a[q]+b[q]+y<<endl;
    }
}

return 0;
}


#include <iostream>
#include <string.h>
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <vector>
#include <map>
#define F first
#define S second
#define ll long long

using namespace std;

int main()
{
//freopen("i.txt","r",stdin);
long long n,m ,a[1000000]={},b[1000000]={},y=0;
cin>>n>>m;
for(int i=1; i<=n; i++)
    cin>>a[i];
for(int i=0; i<m; i++)
{
    int t;
    cin>>t;
    if(t==1)
    {
        int v,x;
        cin>>v>>x;
        a[v]==x;
        b[v]-=y;
    }
    if(t==2)
    {
        int x;
        cin>>x;
        y+=x;
    }
    if(t==3)
    {
        int q;
        cin>>q;
        cout<<a[q]+b[q]+y;
    }
}

return 0;
}


#include <iostream>
#include <string.h>
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <vector>
#include <map>
#define F first
#define S second
#define ll long long

using namespace std;

int main()
{
//freopen("i.txt","r",stdin);
long long n,m ,a[1000000]={},b[1000000]={},y=0;
cin>>n>>m;
for(int i=1; i<=n; i++)
    cin>>a[i];
for(int i=0; i<m; i++)
{
    int t;
    cin>>t;
    if(t==1)
    {
        int v,x;
        cin>>v>>x;
        b[v]+=x;
    }
    if(t==2)
    {
        int x;
        cin>>x;
        y+=x;
    }
    if(t==3)
    {
        int q;
        cin>>q;
        cout<<a[q]+b[q]+y;
    }
}

return 0;
}


#include <iostream>
#include <cstdio>
#include <map>
#include <set>
#include <vector>
#include <algorithm>
#include <cstring>
#include <cstdlib>
#include <string>
#include <cmath>
#include <stack>
using namespace std;

#define MAXN 100010

long long int tree[MAXN]; //árvore
int c;

void create(long long int *t) {
    memset(t, 0, sizeof(long long int)*c);
}

long long int query (long long int *tree, int from, int to) {
    long long int sum;
    if (from != 0)
        return query(tree, 0, to) - query(tree, 0, from-1);
    for (sum = 0; to >= 0; to = (to & (to + 1)) - 1)
        sum += tree[to];
    return sum;
}

void update (long long int *tree, int pos, int incremento) {
    for (; pos < c; pos |= pos + 1) tree[pos] += incremento;
}

int main() {
    int n, m;
    int array[100001];
    int when[100001];
    scanf ("%d %d", &n, &m);
    c = m + 3;
    create(tree);
    int comandos = 1;

    memset (when, 0, sizeof(when));
    for (int i = 1; i <= n; ++i)
        cin >> array[i];

    for (int i = 0; i < m; ++i) {
        int opt; scanf ("%d", &opt);

        if (opt == 1) {
            int v, x;
            scanf ("%d %d", &v, &x);
            array[v] = x;
            when[v] = comandos;
        }
        else if (opt == 2) {
            int y;
            scanf ("%d", &y);
            update(tree, comandos++, y);
        }
        else if (opt == 3) {
            int q;
            scanf ("%d", &q);
            long long int ans = 0;
            ans += array[q];

            if (comandos != when[q])
                ans += query(tree, min(when[q], comandos  -1 ) ,  max (when[q], comandos  -1 ) );
            cout << ans << endl;
        }
    }

    return 0;
}


#include <iostream>
#include <cstdio>
#include <map>
#include <set>
#include <vector>
#include <algorithm>
#include <cstring>
#include <cstdlib>
#include <string>
#include <cmath>
#include <queue>
#include <stack>
using namespace std;

int main() {
    int n, m;
    int array[100001];
    vector <int> comandos;
    int when[100001];

    scanf ("%d %d", &n, &m);

    memset (when, 0, sizeof(int) * (n + 1));

    for (int i = 1; i <= n; ++i)
        cin >> array[i];

    for (int i = 0; i < m; ++i) {
        int opt; scanf ("%d", &opt);

        if (opt == 1) {
            int v, x;
            scanf ("%d %d", &v, &x);
            array[v] = x;
            when[v] = comandos.size();
        }
        else if (opt == 2) {
            int y;
            scanf ("%d", &y);
            comandos.push_back(y);
        }
        else if (opt == 3) {
            int q;
            scanf ("%d", &q);
            long long int ans = 0;
            ans += array[q];
            int len = comandos.size();
            for (int i = when[q]; i < len; ++i) {
                ans += comandos[i];
            }
            cout << ans << endl;
        }
    }

    return 0;
}


#include <iostream>
#include <cstdio>
#include <map>
#include <set>
#include <vector>
#include <algorithm>
#include <cstring>
#include <cstdlib>
#include <string>
#include <cmath>
#include <queue>
#include <stack>
using namespace std;

int main() {
    int n, m;
    int array[100001];
    vector <int> comandos;
    int when[100001];

    scanf ("%d %d", &n, &m);

    memset (when, 0, sizeof(int) * (n + 1));

    for (int i = 1; i <= n; ++i)
        cin >> array[i];

    for (int i = 0; i < m; ++i) {
        int opt; scanf ("%d", &opt);

        if (opt == 1) {
            int v, x;
            scanf ("%d %d", &v, &x);
            array[v] = x;
            when[v] = comandos.size();
        }
        else if (opt == 2) {
            int y;
            scanf ("%d", &y);
            comandos.push_back(y);
        }
        else if (opt == 3) {
            int q;
            scanf ("%d", &q);
           int ans = 0;
            ans += array[q];
            int len = comandos.size();
            for (int i = when[q]; i < len; ++i) {
                ans += comandos[i];
            }
            printf ("%d\n", ans);
        }
    }

    return 0;
}


#include <iostream>
#include <cstdio>
#include <map>
#include <set>
#include <vector>
#include <algorithm>
#include <cstring>
#include <cstdlib>
#include <string>
#include <cmath>
#include <queue>
#include <stack>
using namespace std;

#define MAXN 100010

long long int tree[MAXN]; //árvore
int c;

void create(long long int *t) {
    memset(t, 0, sizeof(long long int)*c);
}

long long int query (long long int *tree, int from, int to) {
    long long int sum;
    if (from != 0)
        return query(tree, 0, to) - query(tree, 0, from-1);
    for (sum = 0; to >= 0; to = (to & (to + 1)) - 1)
        sum += tree[to];
    return sum;
}

void update (long long int *tree, int pos, int incremento) {
    for (; pos < c; pos |= pos + 1) tree[pos] += incremento;
}

int main() {
    int n, m;
    c = MAXN - 10;
    int array[100001];
    int when[100001];
    scanf ("%d %d", &n, &m);

    create(tree);
    int comandos = 0;

    for (int i = 1; i <= n; ++i)
        cin >> array[i];

    for (int i = 0; i < m; ++i) {
        int opt; scanf ("%d", &opt);

        if (opt == 1) {
            int v, x;
            scanf ("%d %d", &v, &x);
            array[v] = x;
            when[v] = comandos;
        }
        else if (opt == 2) {
            int y;
            scanf ("%d", &y);
            update(tree, comandos++, y);
        }
        else if (opt == 3) {
            int q;
            scanf ("%d", &q);
            long long int ans = 0;
            ans += array[q];
            ans += query(tree, when[q], comandos - 1);
            cout << ans << endl;
        }
    }

	return 0;
}


#include <iostream>
#include <cstdio>
#include <map>
#include <set>
#include <vector>
#include <algorithm>
#include <cstring>
#include <cstdlib>
#include <string>
#include <cmath>
#include <queue>
#include <stack>
using namespace std;

#define MAXN 100001

long long int tree[MAXN]; //árvore
int c;

void create(long long int *t) {
    memset(t, 0, sizeof(long long int)*c);
}

long long int query (long long int *tree, int from, int to) {
    long long int sum;
    if (from != 0)
        return query(tree, 0, to) - query(tree, 0, from-1);
    for (sum = 0; to >= 0; to = (to & (to + 1)) - 1)
        sum += tree[to];
    return sum;
}

void update (long long int *tree, int pos, int incremento) {
    for (; pos < c; pos |= pos + 1) tree[pos] += incremento;
}

int main() {
    int n, m;
    c = MAXN;
    int array[100001];
    int when[100001];
    scanf ("%d %d", &n, &m);

    create(tree);
    int comandos = 0;

    for (int i = 1; i <= n; ++i)
        cin >> array[i];

    for (int i = 0; i < m; ++i) {
        int opt; scanf ("%d", &opt);

        if (opt == 1) {
            int v, x;
            scanf ("%d %d", &v, &x);
            array[v] = x;
            when[v] = comandos;
        }
        else if (opt == 2) {
            int y;
            scanf ("%d", &y);
            update(tree, comandos++, y);
        }
        else if (opt == 3) {
            int q;
            scanf ("%d", &q);
            long long int ans = 0;
            ans += array[q];
            ans += query(tree, when[q], comandos - 1);
            cout << ans << endl;
        }
    }

	return 0;
}


#include <iostream>
#include <cstdio>
#include <map>
#include <set>
#include <vector>
#include <algorithm>
#include <cstring>
#include <cstdlib>
#include <string>
#include <cmath>
#include <queue>
#include <stack>
using namespace std;

#define MAXN 100010

long long int tree[MAXN]; //árvore
int c;

void create(long long int *t) {
    memset(t, 0, sizeof(long long int)*c);
}

long long int query (long long int *tree, int from, int to) {
    long long int sum;
    if (from != 0)
        return query(tree, 0, to) - query(tree, 0, from-1);
    for (sum = 0; to >= 0; to = (to & (to + 1)) - 1)
        sum += tree[to];
    return sum;
}

void update (long long int *tree, int pos, int incremento) {
    for (; pos < c; pos |= pos + 1) tree[pos] += incremento;
}

int main() {
    int n, m;
    int array[100001];
    int when[100001];
    scanf ("%d %d", &n, &m);
    c = m + 3;
    create(tree);
    int comandos = 0;

    for (int i = 1; i <= n; ++i)
        cin >> array[i];

    for (int i = 0; i < m; ++i) {
        int opt; scanf ("%d", &opt);

        if (opt == 1) {
            int v, x;
            scanf ("%d %d", &v, &x);
            array[v] = x;
            when[v] = comandos;
        }
        else if (opt == 2) {
            int y;
            scanf ("%d", &y);
            update(tree, comandos++, y);
        }
        else if (opt == 3) {
            int q;
            scanf ("%d", &q);
            long long int ans = 0;
            ans += array[q];
            if (comandos)
            ans += query(tree, when[q], comandos - 1);
            cout << ans << endl;
        }
    }

	return 0;
}


#include <iostream>
#include <cstdio>
#include <map>
#include <set>
#include <vector>
#include <algorithm>
#include <cstring>
#include <cstdlib>
#include <string>
#include <cmath>
#include <queue>
#include <stack>
using namespace std;

#define MAXN 100010

long long int tree[MAXN]; //árvore
int c;

void create(long long int *t) {
    memset(t, 0, sizeof(long long int)*c);
}

long long int query (long long int *tree, int from, int to) {
    long long int sum;
    if (from != 0)
        return query(tree, 0, to) - query(tree, 0, from-1);
    for (sum = 0; to >= 0; to = (to & (to + 1)) - 1)
        sum += tree[to];
    return sum;
}

void update (long long int *tree, int pos, int incremento) {
    for (; pos < c; pos |= pos + 1) tree[pos] += incremento;
}

int main() {
    int n, m;
    int array[100001];
    int when[100001];
    scanf ("%d %d", &n, &m);
    c = m + 3;
    create(tree);
    int comandos = 1;

    memset (when, 0, sizeof(when));
    for (int i = 1; i <= n; ++i)
        cin >> array[i];

    for (int i = 0; i < m; ++i) {
        int opt; scanf ("%d", &opt);

        if (opt == 1) {
            int v, x;
            scanf ("%d %d", &v, &x);
            array[v] = x;
            when[v] = comandos;
        }
        else if (opt == 2) {
            int y;
            scanf ("%d", &y);
            update(tree, comandos++, y);
        }
        else if (opt == 3) {
            int q;
            scanf ("%d", &q);
            long long int ans = 0;
            ans += array[q];

            if (comandos != when[q])
                ans += query(tree, min(when[q], comandos  -1 ) ,  max (when[q], comandos  -1 ) );
            cout << ans << endl;
        }
    }

    return 0;
}


#include <iostream>
#include <cstdio>
#include <map>
#include <set>
#include <vector>
#include <algorithm>
#include <cstring>
#include <cstdlib>
#include <string>
#include <cmath>
#include <queue>
#include <stack>
using namespace std;

#define MAXN 100010

long long int tree[MAXN]; //árvore
int c;

void create(long long int *t) {
    memset(t, 0, sizeof(long long int)*c);
}

long long int query (long long int *tree, int from, int to) {
    long long int sum;
    if (from != 0)
        return query(tree, 0, to) - query(tree, 0, from-1);
    for (sum = 0; to >= 0; to = (to & (to + 1)) - 1)
        sum += tree[to];
    return sum;
}

void update (long long int *tree, int pos, int incremento) {
    for (; pos < c; pos |= pos + 1) tree[pos] += incremento;
}

int main() {
    int n, m;
    int array[100001];
    int when[100001];
    scanf ("%d %d", &n, &m);
    c = m + 3;
    create(tree);
    int comandos = 1;

    for (int i = 1; i <= n; ++i)
        cin >> array[i];

    for (int i = 0; i < m; ++i) {
        int opt; scanf ("%d", &opt);

        if (opt == 1) {
            int v, x;
            scanf ("%d %d", &v, &x);
            array[v] = x;
            when[v] = comandos;
        }
        else if (opt == 2) {
            int y;
            scanf ("%d", &y);
            update(tree, comandos++, y);
        }
        else if (opt == 3) {
            int q;
            scanf ("%d", &q);
            long long int ans = 0;
            ans += array[q];

            if (comandos != when[q])
                ans += query(tree, min(when[q], comandos  -1 ) ,  max (when[q], comandos  -1 ) );
            cout << ans << endl;
        }
    }

	return 0;
}


#include <iostream>
#include <cstdio>
#include <map>
#include <set>
#include <vector>
#include <algorithm>
#include <cstring>
#include <cstdlib>
#include <string>
#include <cmath>
#include <queue>
#include <stack>
using namespace std;

#define MAXN 100010

long long int tree[MAXN]; //árvore
int c;

void create(long long int *t) {
    memset(t, 0, sizeof(long long int)*c);
}

long long int query (long long int *tree, int from, int to) {
    long long int sum;
    if (from != 0)
        return query(tree, 0, to) - query(tree, 0, from-1);
    for (sum = 0; to >= 0; to = (to & (to + 1)) - 1)
        sum += tree[to];
    return sum;
}

void update (long long int *tree, int pos, int incremento) {
    for (; pos < c; pos |= pos + 1) tree[pos] += incremento;
}

int main() {
    int n, m;
    int array[100001];
    int when[100001];
    scanf ("%d %d", &n, &m);
    c = m + 3;
    create(tree);
    int comandos = 0;

    for (int i = 1; i <= n; ++i)
        cin >> array[i];

    for (int i = 0; i < m; ++i) {
        int opt; scanf ("%d", &opt);

        if (opt == 1) {
            int v, x;
            scanf ("%d %d", &v, &x);
            array[v] = x;
            when[v] = comandos;
        }
        else if (opt == 2) {
            int y;
            scanf ("%d", &y);
            update(tree, comandos++, y);
        }
        else if (opt == 3) {
            int q;
            scanf ("%d", &q);
            long long int ans = 0;
            ans += array[q];
            ans += query(tree, when[q], comandos - 1);
            cout << ans << endl;
        }
    }

	return 0;
}


#include <bits/stdc++.h>

using namespace std;

long long k,n,m,a[100005],b[100005],v[100005],q[100005],sol[100005];

int CB(int val)
{
    int st,dr,mij,poz;
    st=1;dr=k;
    while(st<=dr)
    {
        mij=(st+dr)/2;
        if(val>=q[mij]){poz=mij;st=mij+1;}
        else dr=mij-1;
    }
    return poz;
}

int main()
{
    int i,op,x,y,var;
    cin>>n>>m;
    for(i=1;i<=n;i++)
        cin>>a[i];
    var=0;
    for(i=1;i<=m;i++)
    {
        cin>>op;
        if(op==1)
        {
            cin>>x>>y;
            a[x]=y;
            b[x]=i;
        }
        else if(op==2)
        {
            cin>>x;
            v[++k]=x+v[k-1];
            q[k]=i;
        }
        else
        {
            cin>>x;
            if(b[x]>0)sol[++var]=a[x]+(v[k]-v[CB(b[x])]);
            else sol[++var]=a[x]+v[k];
        }
    }
    for(i=1;i<=var;i++)
        cout<<sol[i]<<"\n";

    return 0;
}


<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_project_file>
	<FileVersion major="1" minor="6" />
	<Project>
		<Option title="315b" />
		<Option pch_mode="2" />
		<Option compiler="gcc" />
		<Build>
			<Target title="Debug">
				<Option output="bin/Debug/315b" prefix_auto="1" extension_auto="1" />
				<Option object_output="obj/Debug/" />
				<Option type="1" />
				<Option compiler="gcc" />
				<Compiler>
					<Add option="-g" />
				</Compiler>
			</Target>
			<Target title="Release">
				<Option output="bin/Release/315b" prefix_auto="1" extension_auto="1" />
				<Option object_output="obj/Release/" />
				<Option type="1" />
				<Option compiler="gcc" />
				<Compiler>
					<Add option="-O2" />
				</Compiler>
				<Linker>
					<Add option="-s" />
				</Linker>
			</Target>
		</Build>
		<Compiler>
			<Add option="-Wall" />
			<Add option="-fexceptions" />
		</Compiler>
		<Unit filename="main.cpp" />
		<Extensions>
			<code_completion />
			<envvars />
			<debugger />
			<lib_finder disable_auto="1" />
		</Extensions>
	</Project>
</CodeBlocks_project_file>


#include <bits/stdc++.h>

using namespace std;

int k,n,m,a[100005],b[100005],v[100005],q[100005],sol[100005];

int CB(int val)
{
    int st,dr,mij,poz;
    st=1;dr=k;
    while(st<=dr)
    {
        mij=(st+dr)/2;
        if(val>q[mij]){poz=mij;st=mij+1;}
        else dr=mij-1;
    }
    return poz;
}

int main()
{
    int i,op,x,y,var;
    cin>>n>>m;
    for(i=1;i<=n;i++)
        cin>>a[i];
    var=0;
    for(i=1;i<=m;i++)
    {
        cin>>op;
        if(op==1)
        {
            cin>>x>>y;
            a[x]=y;
            b[x]=i;
        }
        else if(op==2)
        {
            cin>>x;
            v[++k]=x+v[k-1];
            q[k]=i;
        }
        else
        {
            cin>>x;
            if(b[x]>0)sol[++var]=a[x]+(v[k]-v[CB(b[x])]);
            else sol[++var]=a[x]+v[k];
        }
    }
    for(i=1;i<=var;i++)
        cout<<sol[i]<<"\n";
    return 0;
}


#include <bits/stdc++.h>

using namespace std;
long long n,m,a[100005],b[100005],s[100005],sol[100005];

int main()
{
    int i,t,x,y,cnt=0,val=0;
    cin>>n>>m;
    for(i=1;i<=n;i++)
        cin>>a[i];
    for(i=1;i<=m;i++)
    {
        cin>>t;
        if(t==1)
        {
            cin>>x>>y;
            a[x]=y;
            b[x]=cnt;
        }
        else if(t==2)
        {
            cin>>x;
            cnt++;
            s[cnt]=x+s[cnt-1];
        }
        else
        {
            cin>>x;
            sol[++val]=a[x]+s[cnt]-s[b[x]];
        }
    }
    for(i=1;i<=val;i++)
        cout<<sol[i]<<"\n";
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int n,m,a[100005],op,sol[100004];

int main()
{
    int i,x,y,k=0,j;
    cin>>n>>m;
    for(i=1;i<=n;i++)
        cin>>a[i];
    for(i=1;i<=m;i++)
    {
        cin>>op;
        if(op==1)
        {
            cin>>x>>y;
            a[x]=y;
        }
        else if(op==2)
        {
            cin>>x;
            for(j=1;j<=n;j++)
                a[j]+=x;
        }
        else
        {
            cin>>x;
            sol[++k]=a[x];
        }
    }

    for(i=1;i<=k;i++)
        cout<<sol[i]<<"\n";
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

long long k,n,m,a[100005],b[100005],v[100005],q[100005],sol[100005];

int CB(int val)
{
    int st,dr,mij,poz;
    st=1;dr=k;
    while(st<=dr)
    {
        mij=(st+dr)/2;
        if(val>q[mij]){poz=mij;st=mij+1;}
        else dr=mij-1;
    }
    return poz;
}

int main()
{
    int i,op,x,y,var;
    cin>>n>>m;
    for(i=1;i<=n;i++)
        cin>>a[i];
    var=0;
    for(i=1;i<=m;i++)
    {
        cin>>op;
        if(op==1)
        {
            cin>>x>>y;
            a[x]=y;
            b[x]=i;
        }
        else if(op==2)
        {
            cin>>x;
            v[++k]=x+v[k-1];
            q[k]=i;
        }
        else
        {
            cin>>x;
            if(b[x]>0)sol[++var]=a[x]+(v[k]-v[CB(b[x])]);
            else sol[++var]=a[x]+v[k];
        }
    }
    for(i=1;i<=var;i++)
        cout<<sol[i]<<"\n";
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int n,m,op;
long long a[100005],sol[100005];

int main()
{
    int i,x,y,k=0,s=0;
    cin>>n>>m;
    for(i=1;i<=n;i++)
        cin>>a[i];
    for(i=1;i<=m;i++)
    {
        cin>>op;
        if(op==1)
        {
            cin>>x>>y;
            a[x]=y;
        }
        else if(op==2)
        {
            cin>>x;
            s+=x;
        }
        else
        {
            cin>>x;
            sol[++k]=a[x]+s;
        }
    }

    for(i=1;i<=k;i++)
        cout<<sol[i]<<"\n";
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int n,m,a[100005],op;

int main()
{
    int i,x,y;
    cin>>n>>m;
    for(i=1;i<=n;i++)
        cin>>a[i];
    for(i=1;i<=m;i++)
    {
        cin>>op;
        if(op==1)
        {
            cin>>x>>y;
            a[x]=y;
        }
        else if(op==2)
        {
            cin>>x;
            a[1]+=x;
            a[n+1]-=x;
            for(i=1;i<=n;i++)
                a[i]+=a[i-1];
        }
        else
        {
            cin>>x;
            cout<<a[x]<<"\n";
        }
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int n,m,op;
long long a[100005],sol[100004];

int main()
{
    int i,x,y,k=0,j;
    cin>>n>>m;
    for(i=1;i<=n;i++)
        cin>>a[i];
    for(i=1;i<=m;i++)
    {
        cin>>op;
        if(op==1)
        {
            cin>>x>>y;
            a[x]=y;
        }
        else if(op==2)
        {
            cin>>x;
            for(j=1;j<=n;j++)
                a[j]+=x;
        }
        else
        {
            cin>>x;
            sol[++k]=a[x];
        }
    }

    for(i=1;i<=k;i++)
        cout<<sol[i]<<"\n";
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int k,n,m,a[100005],b[100005],v[100005],q[100005],sol[100005];

int CB(int val)
{
    int st,dr,mij,poz;
    st=1;dr=k;
    while(st<=dr)
    {
        mij=(st+dr)/2;
        if(q[mij]>=val){poz=mij;dr=mij-1;}
        else st=mij+1;
    }
    return poz;
}

int main()
{
    int i,op,x,y,var;
    cin>>n>>m;
    for(i=1;i<=n;i++)
        cin>>a[i];
    var=0;
    for(i=1;i<=m;i++)
    {
        cin>>op;
        if(op==1)
        {
            cin>>x>>y;
            a[x]=y;
            b[x]=i;
        }
        else if(op==2)
        {
            cin>>x;
            v[++k]=x+v[k-1];
            q[k]=i;
        }
        else
        {
            cin>>x;
            if(b[x]>0)sol[++var]=a[x]+(v[k]-v[CB(b[x])-1]);
            else sol[++var]=a[x]+v[k];
        }
    }
    for(i=1;i<=var;i++)
        cout<<sol[i]<<"\n";
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int n,m,v[100003];

int CB(int val)
{
    int st,dr,mij,poz;
    st=1;dr=n;
    while(st<=dr)
    {
        mij=(st+dr)/2;
        if(v[mij]==val)return mij;
        else if(v[mij]>val){poz=mij;dr=mij-1;}
        else st=mij+1;
    }
    return poz;
}

int main()
{
    int i,k=0,x;
    cin>>n;
    for(i=1;i<=n;i++)
    {
        cin>>x;
        k+=x;
        v[i]=k;
    }

    cin>>m;
    for(i=1;i<=m;i++)
    {
        cin>>x;
        cout<<CB(x)<<"\n";
    }
    return 0;
}


#include<iostream>
using namespace std;

int main()
{
    int n,m;
    cin>>n>>m;
    long int a[n+1];
    for(int i=1;i<=n;i++)
    {
        cin>>a[i];
    }
    int t[m+1];
    for(int i=1;i<=m;i++)
    {
      cin>>t[i];
      if(t[i]==1)
      { int v,x;
         cin>>v>>x;
         a[v]=x;

      }
      else if(t[i]==2)
      {
        int y;
        cin>>y;
        for(int k=1;k<=n;k++)
        {
            a[k]+=y;
        }

      }
      else if(t[i]==3)
      { int q;
         cin>>q;
         cout<<a[q]<<"\n";

      }
    }

    return 0;
}


#include <iostream>
#include <vector>
#include <cstdlib>
using namespace std;

int main() {
	 int n ,  m , i , j , a, b, choice , temp ;
	 cin >> n >> m ;
	 long long arr[n] ;
	 long long  inc ;
	 for ( i = 0 ; i < n ; i ++)
	 cin >> arr[i] ;

	 inc = 0;
	 for ( i = 0 ; i < m ; i++)
	 {
	 	cin >> choice ;
	 	  if( choice == 1){
	 	  	cin >> a >> b;
	 	  	arr[a-1] = abs(inc - b);
	 	  }
	 	  else if(choice == 2){
	 	  	cin >> a ;
	 	  	inc += a;

	 	  }
	 	  else {
	 	  	cin >> a ;
	 	  	cout << arr[a-1] + inc <<endl ;
	 	  }

	 }

	return 0;
}


#include <iostream>
#include <vector>
#include <cstdlib>
using namespace std;

int main() {
	 int n ,  m , i , j , a, b, choice , temp ;
	 cin >> n >> m ;
	 long long arr[n] ;
	 long long  inc ;
	 for ( i = 0 ; i < n ; i ++)
	 cin >> arr[i] ;

	 inc = 0;
	 for ( i = 0 ; i < m ; i++)
	 {
	 	cin >> choice ;
	 	  if( choice == 1){
	 	  	cin >> a >> b;
	 	  	arr[a-1] = b - inc ;
	 	  }
	 	  else if(choice == 2){
	 	  	cin >> a ;
	 	  	inc += a;

	 	  }
	 	  else {
	 	  	cin >> a ;
	 	  	cout << arr[a-1] + inc <<endl ;
	 	  }

	 }

	return 0;
}


#include <iostream>
#include <vector>
#include <cstdlib>
using namespace std;

int main() {
	 int n ,  m , i , j , a, b, choice , temp ;
	 cin >> n >> m ;
	 long arr[n] ;
	 long long  inc ;
	 for ( i = 0 ; i < n ; i ++)
	 cin >> arr[i] ;

	 inc = 0;
	 for ( i = 0 ; i < m ; i++)
	 {
	 	cin >> choice ;
	 	  if( choice == 1){
	 	  	cin >> a >> b;
	 	  	arr[a-1] = abs(inc - b);
	 	  }
	 	  else if(choice == 2){
	 	  	cin >> a ;
	 	  	inc += a;

	 	  }
	 	  else {
	 	  	cin >> a ;
	 	  	cout << arr[a-1] + inc <<endl ;
	 	  }

	 }

	return 0;
}


#include <iostream>
#include <vector>
using namespace std;

int main() {
	 int n ,  m , i , j , a, b, choice , temp ;
	 cin >> n >> m ;
	 long arr[n] ;
	 long long  inc ;
	 for ( i = 0 ; i < n ; i ++)
	 cin >> arr[i] ;

	 inc = 0;
	 for ( i = 0 ; i < m ; i++)
	 {
	 	cin >> choice ;
	 	  if( choice == 1){
	 	  	cin >> a >> b;
	 	  	arr[a-1] = inc - b;
	 	  }
	 	  else if(choice == 2){
	 	  	cin >> a ;
	 	  	inc += a;

	 	  }
	 	  else {
	 	  	cin >> a ;
	 	  	cout << arr[a-1] + inc <<endl ;
	 	  }

	 }

	return 0;
}


#include <cstdio>
#include <string.h>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <iostream>

using namespace std;

int main() {
   int n, m, a[100001],  x;
   scanf("%d %d", &n, &m);
   x = 0;
   for(int i = 1; i<=n; i++){
      scanf("%d", &a[i]);
   }
   for(int i = 1; i<=m; i++) {
       int t;
       scanf("%d", &t);
       if(t == 3) {
         int b;
         scanf("%d", &b);
         printf("%d\n", a[b] + x);

       }
       if(t == 1) {
         int b, c;
         scanf("%d %d", &b, &c);
         a[b] = (c - x);

       }
       if(t == 2) {
          int b;
          scanf("%d", &b);
          x+=b;

       }
   }

 }


#include <cstdio>
#include <string.h>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <iostream>

using namespace std;

int main() {
   int n, m, a[10001],  x;
   scanf("%d %d", &n, &m);
   x = 0;
   for(int i = 1; i<=n; i++){
      scanf("%d", &a[i]);
   }
   for(int i = 1; i<=m; i++) {
       int t;
       scanf("%d", &t);
       if(t == 3) {
         int b;
         scanf("%d", &b);
         printf("%d\n", a[b] + x);

       }
       if(t == 1) {
         int b, c;
         scanf("%d %d", &b, &c);
         a[b] -=(c - x);

       }
       if(t == 2) {
          int b;
          scanf("%d", &b);
          x+=b;

       }
   }

 }


#include <cstdio>
#include <string.h>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <iostream>

using namespace std;

int main() {
   int n, m, a[10001],  x;
   scanf("%d %d", &n, &m);
   x = 0;
   for(int i = 1; i<=n; i++){
      scanf("%d", &a[i]);
   }
   for(int i = 1; i<=m; i++) {
       int t;
       scanf("%d", &t);
       if(t == 3) {
         int b;
         scanf("%d", &b);
         printf("%d", a[b] + x);

       }
       if(t == 1) {
         int b, c;
         scanf("%d %d", &b, &c);
         a[b] -=(c - x);

       }
       if(t == 2) {
          int b;
          scanf("%d", &b);
          x+=b;

       }
   }

 }


#include <cstdio>
#include <string.h>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <iostream>

using namespace std;

int main() {
   int n, m, a[100001], v[100001], x[100001], y[100001], t[100001], q[100001], vv = 0, xx = 0, yy=0, qq = 0;
   scanf("%d %d", &n, &m);
   for(int i = 1; i<=n; i++){
      scanf("%d", &a[i]);
   }
   for(int i = 1; i<=m; i++) {
       scanf("%d", &t[i]);
       if(t[i] == 1) {
          scanf("%d %d", &v[vv], &x[xx]);
          a[v[vv]] = x[xx];
          vv++;
          xx++;
       }
       if(t[i] == 2) {
          scanf("%d", &y[yy]);
          for(int i = 1; i<=n; i++) {
            a[i]+=y[yy];
          }
          yy++;
       }
       if(t[i] == 3) {
         scanf("%d", &q[qq]);
         printf("%d\n", a[q[qq]]);
         qq++;
       }
   }
 }


#include <cstdio>
#include <string.h>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <iostream>

using namespace std;

int main() {
   int n, m, a[100001], v[100001], x[100001], y[100001], t[100001], q[100001], vv = 0, xx = 0, yy=0, qq = 0;
   scanf("%d %d", &n, &m);
   for(int i = 1; i<=n; i++){
      scanf("%d", &a[i]);
   }
   for(int i = 1; i<=m; i++) {
       scanf("%d", &t[i]);
       if(t[i] == 1) {
          scanf("%d %d", &v[vv], &x[xx]);
          a[v[vv]] = x[xx];
          vv++;
          xx++;
       }
       if(t[i] == 2) {
          scanf("%d", &y[yy]);
          for(int i = 1; i<=n; i++) {
            a[i]+=y[yy];
          }
          yy++;
       }
       if(t[i] == 3) {
         scanf("%d", &q[qq]);
         printf("%d", a[q[qq]]);
         qq++;
       }
   }
 }


#include <cstdio>
#include <string.h>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <iostream>

using namespace std;

int main() {
   int n, m, a[10001],  x;
   scanf("%d %d", &n, &m);
   x = 0;
   for(int i = 1; i<=n; i++){
      scanf("%d", &a[i]);
   }
   for(int i = 1; i<=m; i++) {
       int t;
       scanf("%d", &t);
       if(t == 3) {
         int b;
         scanf("%d", &b);
         printf("%d\n", a[b] + x);

       }
       if(t == 1) {
         int b, c;
         scanf("%d %d", &b, &c);
         a[b] = (c - x);

       }
       if(t == 2) {
          int b;
          scanf("%d", &b);
          x+=b;

       }
   }

 }


#include<iostream>
#include<vector>

using namespace std;

int main()
 {
    int ti,qi,yi,vi,n,m,i,j,adder=0, a[100001];
    long long int xi;
    cin>>n;
    cin>>m;
    for(i=1;i<=n;i++)
        cin>>a[i];

    for(i=1;i<=m;i++)
     {
        cin>>ti;
        switch(ti)
         {
            case 1: cin>>vi;
                    cin>>xi;
                    a[vi]=xi-adder;
                    break;

            case 2: cin>>yi;
                    adder+=yi;
                    break;

            case 3: cin>>qi;
                    cout<<a[qi]+adder<<"\n";
                    break;
         }
     }

    return 0;
 }


#include<iostream>
#include<vector>

using namespace std;

int main()
 {
    int ti,qi,yi,vi,n,m,i,j;
    long long int xi;
    cin>>n;
    cin>>m;

    vector<int>a(n);
    for(i=1;i<=n;i++)
        cin>>a[i];

    for(i=1;i<=m;i++)
     {
        cin>>ti;
        switch(ti)
         {
            case 1: cin>>vi;
                    cin>>xi;
                    a[vi]=xi;
                    break;

            case 2: cin>>yi;
                    for(j=1;j<=n;j++)
                     {
                        a[j]+=yi;
                     }
                    break;

            case 3: cin>>qi;
                    cout<<a[qi]<<" ";
                    break;
         }
     }

    return 0;
 }


#include<iostream>
#include<vector>

using namespace std;

int main()
 {
    int ti,qi,yi,vi,n,m,i,j,adder=0;
    long long int xi;
    cin>>n;
    cin>>m;

    vector<int>a(n);
    for(i=1;i<=n;i++)
        cin>>a[i];

    for(i=1;i<=m;i++)
     {
        cin>>ti;
        switch(ti)
         {
            case 1: cin>>vi;
                    cin>>xi;
                    a[vi]=xi-adder;
                    break;

            case 2: cin>>yi;
                    adder+=yi;
                    break;

            case 3: cin>>qi;
                    cout<<a[qi]+adder<<"\n";
                    break;
         }
     }

    return 0;
 }


#include<iostream>

using namespace std;

int main()
 {
    int ti,qi,yi,vi,n,m,i,j,adder=0, a[100001];
    long long int xi;
    cin>>n;
    cin>>m;
    for(i=1;i<=n;i++)
        cin>>a[i];

    for(i=1;i<=m;i++)
     {
        cin>>ti;
        switch(ti)
         {
            case 1: cin>>vi;
                    cin>>xi;
                    a[vi]=xi-adder;
                    break;

            case 2: cin>>yi;
                    adder+=yi;
                    break;

            case 3: cin>>qi;
                    cout<<a[qi]+adder<<"\n";
                    break;
         }
     }

    return 0;
 }


#include <iostream>

using namespace std;

int main()
{
    long long n, m;

    cin >> n >> m;

    long long a[n];

    for (long long i = 0; i < n; i++) {
        cin >> a[i];
    }

    for (long long i = 0; i < m; i++) {
        long long t;

        cin >> t;

        switch(t) {
            case 1: {
                long long y, z;

                cin >> y >> z;

                a[y - 1] = z;
                break;
            }
            case 2: {
                long long y;

                cin >> y;

                for (long long j = 0; j < n; j++) {
                    a[j] = a[j] + y;
                }
                break;
            }
            case 3: {
                long long y;

                cin >> y;

                cout << a[y - 1] << endl;
            }
            break;
        }
    }

    return 0;
}


#include <iostream>

using namespace std;

int main()
{
    int n, m;

    cin >> n >> m;
    long long a[n];

    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }

    int t;
    int y = 0;

    for (int i = 0; i < m; i++) {
        cin >> t;
        if (t == 1) {
            int v;
            long long x;
            cin >> v >> x;

            a[v - 1] = x - y;
        } else if (t == 2) {
            int x;
            cin >> x;
            y += x;
        } else if (t == 3) {
            int q;
            cin >> q;
            cout << a[q - 1] + y << endl;
        }
    }

    return 0;
}


#include <iostream>
#include <algorithm>

using namespace std;

int main()
{
	int n;

	cin >> n;

	int a[n];
	int b[n];

	for (int i = 0; i < n; i++) {
		cin >> a[i] >> b[i];
	}

	int bottle = 0;

	int c[n];

	copy(a, a + n, c);

	sort(c, c + n);

	for (int i = 0; i < n; i++) {
		if (a[i] != b[i]) {
			if (binary_search(c, c + n, b[i])) {
				bottle++;
			}
		} else if (a[i] == b[i]) {
			if (count(a, a + n, b[i]) > 1 || count(b, b + n, b[i]) > 1) {
				bottle++;
			}
		}
	}

	cout << n - bottle;

	return 0;
}


#include <iostream>

using namespace std;

int main()
{
    int n, m;

    cin >> n >> m;

    int a[n];

    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }

    int v = 0;

    for (int i = 0; i < m; i++) {
        int t;

        cin >> t;

        switch(t) {
            case 1: {
                int y, z;

                cin >> y >> z;

                a[y - 1] = z - v;
                break;
            }
            case 2: {
                int y;
                cin >> y;

                v = v + y;
                break;
            }
            case 3: {
                int y;

                cin >> y;

                cout << a[y - 1] + v << endl;
            }
            break;
        }
    }

    return 0;
}


#include <iostream>

using namespace std;

int main()
{
    int n, m;

    cin >> n >> m;

    int a[n];

    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }

    int v = 0;

    for (int i = 0; i < m; i++) {
        int t;

        cin >> t;

        switch(t) {
            case 1: {
                int y, z;

                cin >> y >> z;

                a[y - 1] = z;
                break;
            }
            case 2: {
                int y;
                cin >> y;

                v = v + y;
                break;
            }
            case 3: {
                int y;

                cin >> y;

                cout << a[y - 1] + v<< endl;
            }
            break;
        }
    }

    return 0;
}


#include <iostream>

using namespace std;

int main()
{
    int n, m;

    cin >> n >> m;

    int a[n];

    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }

    for (int i = 0; i < m; i++) {
        int t;

        cin >> t;

        switch(t) {
            case 1: {
                int y, z;

                cin >> y >> z;

                a[y - 1] = z;
                break;
            }
            case 2: {
                int y;

                cin >> y;

                for (int j = 0; j < n; j++) {
                    a[j] = a[j] + y;
                }
                break;
            }
            case 3: {
                int y;

                cin >> y;

                cout << a[y - 1] << endl;
            }
            break;
        }
    }

    return 0;
}


#include <iostream>

using namespace std;

int main()
{
    int n, m;

    cin >> n >> m;
    long long a[n];

    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }

    int t;
    int y = 0;

    for (int i = 0; i < m; i++) {
        cin >> t;
        if (t == 1) {
            int v;
            long long x;
            cin >> v >> x;

            a[v - 1] = x - y;
        } else if (t == 2) {
            int x;
            cin >> x;
            y += x;
        } else if (t == 3) {
            int q;
            cin >> q;
            cout << a[q - 1] + y;
        }
    }

    return 0;
}


#include <iostream>

using namespace std;

int main() {
 //   cout << "n, m : reading..." << endl;
    long n, m;
    cin >> n >> m;

    long *arr = new long[n];

    for (long i = 0; i < n; i++) {
        cin >> arr[i];
    }

    for (long i = 0; i < m; i++) {
        long num;
        cin >> num;
        switch (num) {
        case 1:
            long v, x;
            cin >> v >> x;
            arr[v - 1] = x;
            break;
        case 2:
            long y;
            cin >> y;
            for (long i = 0; i < n; i++) {
                arr[i] += y;
            }
            break;
        case 3:
            long q;
            cin >> q;
            cout << arr[q - 1] << endl;
            break;
        default:
            break;
        }
    }
}


#include <iostream>

using namespace std;

int main() {
 //   cout << "n, m : reading..." << endl;
    long n, m;
    cin >> n >> m;
    long y = 0, v = 0, x = 0;

    long *arr = new long[n];

    for (long i = 0; i < n; i++) {
        cin >> arr[i];
    }

    for (long i = 0; i < m; i++) {
        long num;
        cin >> num;
        switch (num) {
        case 1:
            cin >> v >> x;
            arr[v - 1] = x - y;
            break;
        case 2:
            long tmpY;
            cin >> tmpY;
            y += tmpY;
            break;
        case 3:
            long q;
            cin >> q;
            cout << arr[q - 1] + y << endl;
            break;
        default:
            break;
        }
    }
}


#include <iostream>

using namespace std;

int main() {
 //   cout << "n, m : reading..." << endl;
    int n, m;
    cin >> n >> m;
    int y = 0, v = 0, x = 0;

    int *arr = new int[n];

    for (int i = 0; i < n; i++) {
        cin >> arr[i];
    }

    for (int i = 0; i < m; i++) {
        int num;
        cin >> num;
        switch (num) {
        case 1:
            cin >> v >> x;
            arr[v - 1] = x - y;
            break;
        case 2:
            int tmpY;
            cin >> tmpY;
            y += tmpY;
            break;
        case 3:
            int q;
            cin >> q;
            cout << arr[q - 1] + y << endl;
            break;
        default:
            break;
        }
    }
}


#include <iostream>

using namespace std;

int main() {
 //   cout << "n, m : reading..." << endl;
    long n, m;
    cin >> n >> m;
    long y = 0, v = 0, x = 0;

    long *arr = new long[n];

    for (long i = 0; i < n; i++) {
        cin >> arr[i];
    }

    for (long i = 0; i < m; i++) {
        long num;
        cin >> num;
        switch (num) {
        case 1:
            cin >> v >> x;
            arr[v - 1] = x - y;
            break;
        case 2:
            cin >> y;
            break;
        case 3:
            long q;
            cin >> q;
            cout << arr[q - 1] + y << endl;
            break;
        default:
            break;
        }
    }
}


#include <iostream>

using namespace std;

int n, m;

int main() {
 //   cout << "n, m : reading..." << endl;
    cin >> n >> m;

    int *arr = new int[n];

    for (int i = 0; i < n; i++) {
        cin >> arr[i];
    }

    for (int i = 0; i < m; i++) {
        int num;
        cin >> num;
        switch (num) {
        case 1:
            int v, x;
            cin >> v >> x;
            arr[v - 1] = x;
            break;
        case 2:
            int y;
            cin >> y;
            for (int i = 0; i < n; i++) {
                arr[i] += y ;
            }
            break;
        case 3:
            int q;
            cin >> q;
            cout << arr[q - 1];
            break;
        default:
            break;
        }
    }
}


#define boostit ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define ll long long int
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;

#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")

#define F first
#define S second
#define mp make_pair
#define pb push_back
#define vi vector<ll>
#define pii pair<ll,ll>
#define qi queue<ll>
#define mem(a,b) memset(a,b,sizeof(a))
#define ll long long int
#define print(a) cout<<a<<endl
#define sorted(a) sort(arr.begin(), arr.end())
#define gcd(a,b) __gcd((a),(b))
#define lcm(a,b) ((a)*(b))/gcd((a),(b))
#define read(a) scanf("%d", &a)
int main()
{
 boostit;
 ll t;
 //cin>>t;
 t=1;
  while(t--)
   {
    string s;
    cin>>s;
    ll count=0;
    for(ll i=1;i<s.length();)
     {
       if(s[i]==s[i-1])
           {s.erase(i-1,2);count++;i--;if(i==0)i=1;}
       else i++;
      //cout<<i<<" "<<s<<" "<<count<<endl;
     }
   // cout<<count<<endl;
    if(count%2==0)
       cout<<"No"<<endl;
    else
       cout<<"Yes"<<endl;
   }
  cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
  return 0;
}


#define boostit ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define ll long long int
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;

#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")

#define F first
#define S second
#define mp make_pair
#define pb push_back
#define vi vector<ll>
#define pii pair<ll,ll>
#define qi queue<ll>
#define mem(a,b) memset(a,b,sizeof(a))
#define ll long long int
#define print(a) cout<<a<<endl
#define sorted(a) sort(arr.begin(), arr.end())
#define gcd(a,b) __gcd((a),(b))
#define lcm(a,b) ((a)*(b))/gcd((a),(b))
#define read(a) scanf("%d", &a)
int main()
{
 boostit;
 ll t;
 //cin>>t;
 t=1;
  while(t--)
   {
    string s,str;
    cin>>s;
    ll count=0,len=s.length(),j=-1,i=0,flag=0,rr=0,prev_i=-1,prev_j=-1;
    while(i<len)
     {
       if(i<len-1){
       if(s[i]==s[i+1])
          {count++;flag=1;prev_j=i+2;i+=1;}
       else{prev_i=i;flag=0;i++;}}
      if(prev_i>=0&& prev_j<len&&flag==1){if(s[prev_i]==s[prev_j]){count++;i=prev_j+1;prev_i--;prev_j++;/*cout<<prev_i<<" "<<prev_j<<endl;*/}}
      else i++;
     }
    //cout<<prev_j<<" "<<prev_i<<" "<<count<<endl;
    if(count%2==0)
       cout<<"No"<<endl;
    else
       cout<<"Yes"<<endl;
   }
  cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
  return 0;
}


#define boostit ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define ll long long int
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;

#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")

#define F first
#define S second
#define mp make_pair
#define pb push_back
#define vi vector<ll>
#define pii pair<ll,ll>
#define qi queue<ll>
#define mem(a,b) memset(a,b,sizeof(a))
#define ll long long int
#define print(a) cout<<a<<endl
#define sorted(a) sort(arr.begin(), arr.end())
#define gcd(a,b) __gcd((a),(b))
#define lcm(a,b) ((a)*(b))/gcd((a),(b))
#define read(a) scanf("%d", &a)
int main()
{
 boostit;
 ll t;
 //cin>>t;
 t=1;
  while(t--)
   {
    string s,str;
    cin>>s;
    ll count=0,len=s.length(),j=-1,i=0,flag=0,rr=0,prev_i=-1,prev_j=-1;
    while(i<len)
     {

       if(i<len-1&&s[i]==s[i+1])
          {count++;flag=1;prev_j=i+2;i+=2;}
       else{
          if(prev_i>=0&& prev_j<len&&flag==1){if(s[prev_i]==s[prev_j]){count++;i=prev_j+1;prev_i--;prev_j++;}}
          else{
         prev_i=i;flag=0;i++;}
         }
     /*cout<<prev_i<<" "<<prev_j<<endl;*/
      //else i++;
     }
   // cout<<prev_j<<" "<<prev_i<<" "<<count<<endl;
    if(count%2==0)
       cout<<"No"<<endl;
    else
       cout<<"Yes"<<endl;
   }
  cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
  return 0;
}


#define boostit ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define ll long long int
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;

#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")

#define F first
#define S second
#define mp make_pair
#define pb push_back
#define vi vector<ll>
#define pii pair<ll,ll>
#define qi queue<ll>
#define mem(a,b) memset(a,b,sizeof(a))
#define ll long long int
#define print(a) cout<<a<<endl
#define sorted(a) sort(arr.begin(), arr.end())
#define gcd(a,b) __gcd((a),(b))
#define lcm(a,b) ((a)*(b))/gcd((a),(b))
#define read(a) scanf("%d", &a)
int main()
{
 boostit;
 ll t;
 //cin>>t;
 t=1;
  while(t--)
   {
    string s;
    cin>>s;
    ll count=0,len=s.length();
    for(ll i=0;i<s.length()-1;i++)
     {
       if(s[i]==s[i+1])
           {s.erase(i,2);i--;count++;}
     }

    if(count%2==0)
       cout<<"No"<<endl;
    else
       cout<<"Yes"<<endl;
   }
  cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
  return 0;
}


#define boostit ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define ll long long int
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;

#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")

#define F first
#define S second
#define mp make_pair
#define pb push_back
#define vi vector<ll>
#define pii pair<ll,ll>
#define qi queue<ll>
#define mem(a,b) memset(a,b,sizeof(a))
#define ll long long int
#define print(a) cout<<a<<endl
#define sorted(a) sort(arr.begin(), arr.end())
#define gcd(a,b) __gcd((a),(b))
#define lcm(a,b) ((a)*(b))/gcd((a),(b))
#define read(a) scanf("%d", &a)
int main()
{
 boostit;
 ll t;
 //cin>>t;
 t=1;
  while(t--)
   {
    string s,str;
    cin>>s;
    ll count=0,len=s.length(),j=-1,i=0,flag=0,rr=0,prev_i=-1,prev_j=-1;
    while(i<len)
     {
       if(i<len-1){
       if(s[i]==s[i+1])
          {count++;flag=1;prev_j=i+2;i+=2;}
       else{prev_i=i;flag=0;i++;}}
      if(prev_i>=0&& prev_j<len&&flag==1){if(s[prev_i]==s[prev_j]){count++;i=prev_j+1;prev_i--;prev_j++;/*cout<<prev_i<<" "<<prev_j<<endl;*/}}
      else i++;
     }
    //cout<<prev_j<<" "<<prev_i<<" "<<count<<endl;
    if(count%2==0)
       cout<<"No"<<endl;
    else
       cout<<"Yes"<<endl;
   }
  cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
  return 0;
}


#define boostit ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define ll long long int
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;

#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")

#define F first
#define S second
#define mp make_pair
#define pb push_back
#define vi vector<ll>
#define pii pair<ll,ll>
#define qi queue<ll>
#define mem(a,b) memset(a,b,sizeof(a))
#define ll long long int
#define print(a) cout<<a<<endl
#define sorted(a) sort(arr.begin(), arr.end())
#define gcd(a,b) __gcd((a),(b))
#define lcm(a,b) ((a)*(b))/gcd((a),(b))
#define read(a) scanf("%d", &a)
int main()
{
 boostit;
 ll t;
 //cin>>t;
 t=1;
  while(t--)
   {
    string s,str;
    cin>>s;
    ll count=0,len=s.length(),j=0,flag=0,rr=0;
    for(ll i=0;i<s.length();i++)
     {
       if(i<len-1 && s[i]==s[i+1])
           {i++;count++;flag=1;if(j==i-1)j=i+1;}
       else {if(j!=i&&flag==1){if(s[j]==s[i]){count++;i++;j=i+1;}}}
     }
    //cout<<count<<endl;
    if(count%2==0)
       cout<<"No"<<endl;
    else
       cout<<"Yes"<<endl;
   }
  cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
  return 0;
}


#define boostit ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define ll long long int
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;

#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")

#define F first
#define S second
#define mp make_pair
#define pb push_back
#define vi vector<ll>
#define pii pair<ll,ll>
#define qi queue<ll>
#define mem(a,b) memset(a,b,sizeof(a))
#define ll long long int
#define print(a) cout<<a<<endl
#define sorted(a) sort(arr.begin(), arr.end())
#define gcd(a,b) __gcd((a),(b))
#define lcm(a,b) ((a)*(b))/gcd((a),(b))
#define read(a) scanf("%d", &a)
int main()
{
 boostit;
 ll t;
 //cin>>t;
 t=1;
  while(t--)
   {
    string s,str;
    cin>>s;
    ll count=0,len=s.length(),j=-1,i=0,flag=0,rr=0,prev_i=-1,prev_j=-1;
    while(i<len)
     {

       if(i<len-1&&s[i]==s[i+1])
          {count++;i+=2;}
       else{
          if(prev_i>=0 && s[prev_i]==s[i]){count++;i++;prev_i--;}
          else{
         prev_i=i;flag=0;i++;}
         }
     /*cout<<prev_i<<" "<<prev_j<<endl;*/
      //else i++;
     }
   // cout<<prev_j<<" "<<prev_i<<" "<<count<<endl;
    if(count%2==0)
       cout<<"No"<<endl;
    else
       cout<<"Yes"<<endl;
   }
  cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
  return 0;
}