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*.
# Problem Link:     https://codeforces.com/problemset/problem/222/B
# Problem Status:   TIME LIMIT EXCEEDED ON TEST CASE NUMBER 12.
# --------------------------- SEPARATOR ---------------------------
import io
import os


l = 0
s = io.BytesIO(os.read(0, os.fstat(0).st_size)).readlines()
input = s[l].decode()
l += 1
N, M, K = list(map(int, input.split()))
A = []
Q = []
CS = dict()
CS2 = dict()
for j in range(N):
    input = s[l].decode()
    l += 1
    A.append(list(map(int, input.split())))
while K > 0:
    Q.clear()
    input = s[l].decode()
    l += 1
    X, Y, Z = input.split()
    Y, Z = int(Y), int(Z)
    i = -1
    if X == 'g':
        if CS2.get(Z) is None:
            print(A[Y - 1][Z - 1])
        else:
            print(A[Y - 1][CS2.get(Z) - 1])
    elif X == 'r':
        X = A[Y - 1].copy()
        A[Y - 1] = A[Z - 1].copy()
        A[Z - 1] = X.copy()
    elif X == 'c':
        T1 = CS2.get(Y)
        if T1 is None:
            T1 = Y
        T2 = CS2.get(Z)
        if T2 is None:
            T2 = Z
        CS.update({T1: Z})
        CS.update({T2: Y})
        CS2.update({Z: T1})
        CS2.update({Y: T2})
    K -= 1
