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*.
import sys
from math import gcd, sqrt
from io import BytesIO, IOBase

sys.setrecursionlimit(10 ** 5)

BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        import os

        self.os = os
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = self.os.read(self._fd, max(self.os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = self.os.read(self._fd, max(self.os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            self.os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")

inf = float("inf")
en = lambda x: list(enumerate(x))
# input = sys.stdin.readline
ii = lambda: int(input())
r = lambda: map(int, input().split())
rr = lambda: list(r())


a, b, k = r()
arr = [rr() for _ in range(a)]

row = {i: i for i in range(1, a + 1)}
col = {i: i for i in range(1, b + 1)}


for _ in range(k):
    x, y, z = input().split()
    y = int(y)
    z = int(z)

    if x == "r":
        row[y], row[z] = row[z], row[y]
    elif x == "c":
        col[y], col[z] = col[z], col[y]
    else:
        y = row[y] - 1
        z = col[z] - 1
        print(arr[y][z])
