The Free Meteor Association (FMA) has got a problem: as meteors are moving, the Universal Cosmic Descriptive Humorous Program (UCDHP) needs to add a special module that would analyze this movement. 

UCDHP stores some secret information about meteors as an *n* × *m* table with integers in its cells. The order of meteors in the Universe is changing. That's why the main UCDHP module receives the following queries:
 -  The query to swap two table rows; -  The query to swap two table columns; -  The query to obtain a secret number in a particular table cell. 
As the main UCDHP module is critical, writing the functional of working with the table has been commissioned to you.
The first line contains three space-separated integers *n*, *m* and *k* (1 ≤ *n*, *m* ≤ 1000, 1 ≤ *k* ≤ 500000) — the number of table columns and rows and the number of queries, correspondingly.

Next *n* lines contain *m* space-separated numbers each — the initial state of the table. Each number *p* in the table is an integer and satisfies the inequality 0 ≤ *p* ≤ 10<sup class="upper-index">6</sup>.

Next *k* lines contain queries in the format "*s*<sub class="lower-index">*i*</sub> *x*<sub class="lower-index">*i*</sub> *y*<sub class="lower-index">*i*</sub>", where *s*<sub class="lower-index">*i*</sub> is one of the characters "с", "r" or "g", and *x*<sub class="lower-index">*i*</sub>, *y*<sub class="lower-index">*i*</sub> are two integers.
 -  If *s*<sub class="lower-index">*i*</sub> = "c", then the current query is the query to swap columns with indexes *x*<sub class="lower-index">*i*</sub> and *y*<sub class="lower-index">*i*</sub> (1 ≤ *x*, *y* ≤ *m*, *x* ≠ *y*); -  If *s*<sub class="lower-index">*i*</sub> = "r", then the current query is the query to swap rows with indexes *x*<sub class="lower-index">*i*</sub> and *y*<sub class="lower-index">*i*</sub> (1 ≤ *x*, *y* ≤ *n*, *x* ≠ *y*); -  If *s*<sub class="lower-index">*i*</sub> = "g", then the current query is the query to obtain the number that located in the *x*<sub class="lower-index">*i*</sub>-th row and in the *y*<sub class="lower-index">*i*</sub>-th column (1 ≤ *x* ≤ *n*, 1 ≤ *y* ≤ *m*). 
The table rows are considered to be indexed from top to bottom from 1 to *n*, and the table columns — from left to right from 1 to *m*.
'''def colchanger(l,x,y,n):
	for i in range(n):
		l[i][x-1],l[i][y-1]=l[i][y-1], l[i][x-1]

def rowchanger(l,x,y,m):
	for i in range(m):
		l[x-1][i],l[y-1][i]=l[y-1][i], l[x-1][i]'''

def main():
	n, m, k = map(int, input().split())
	R = {str(i): i - 1 for i in range(n+1)}
	C = {str(i): i - 1 for i in range(m+1)}
	ans = []
	l = [input().split() for i in range(n)]
	for i in range(k):
		q, x, y = input().split()
		if q == 'c':
			C[x], C[y] = C[y], C[x]
		elif q == 'r':
			R[x], R[y] = R[y], R[x]
		else:
			ans.append(l[R[x]][C[y]])
	print('\n'.join(ans))
	'''n,m,k = map(int, input().split())
	l=[]
	for i in range(n):
		l.append(list(map(int, input().split())))
	#q=[]
	r=dict()
	c=dict()
	#for zzz in range(k):
	#	s,x,y= [i for i in input().split()]
	#	q.append([s, int(x),int(y)])
	for j in range(k):
		s,x,y= input().split()
		a=int(x)-1
		b=int(y)-1
		if s=='g':
			print(l[r.get(a,a)][c.get(b,b)])
		elif s=='r':
			r[a],r[b]=r.get(b,b),r.get(a,a)
			#for i in range(n):
				#l[i][j[1]-1],l[i][j[2]-1]=l[i][j[2]-1], l[i][j[1]-1]
			#colchanger(l,i[1],i[2],n)
		else:
			c[a],c[b]=c.get(b,b),c.get(a,a)
			#for i in range(m):
				#l[j[1]-1][i],l[j[2]-1][i]=l[j[2]-1][i], l[j[1]-1][i]
			#rowchanger(l,i[1],i[2],m)
	
		
	return 0'''

if __name__ == '__main__':
	main()
