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*.
"Template made by : https://codeforces.com/profile/c1729 , github repo : https://github.com/cheran-senthil/PyRival"
from __future__ import division, print_function
import bisect
import math
import itertools
import sys
from atexit import register

if sys.version_info[0] < 3:
    from io import BytesIO as stream
else:
    from io import StringIO as stream


if sys.version_info[0] < 3:
    class dict(dict):
        """dict() -> new empty dictionary"""
        def items(self):
            """D.items() -> a set-like object providing a view on D's items"""
            return dict.iteritems(self)

        def keys(self):
            """D.keys() -> a set-like object providing a view on D's keys"""
            return dict.iterkeys(self)

        def values(self):
            """D.values() -> an object providing a view on D's values"""
            return dict.itervalues(self)

    input = raw_input
    range = xrange

    filter = itertools.ifilter
    map = itertools.imap
    zip = itertools.izip


def sync_with_stdio(sync=True):
    """Set whether the standard Python streams are allowed to buffer their I/O.

    Args:
        sync (bool, optional): The new synchronization setting.

    """
    global input, flush

    if sync:
        flush = sys.stdout.flush
    else:
        sys.stdin = stream(sys.stdin.read())
        input = lambda: sys.stdin.readline().rstrip('\r\n')

        sys.stdout = stream()
        register(lambda: sys.__stdout__.write(sys.stdout.getvalue()))

def main():
    n,m,k=map(int,input().split())
    d1={}
    d2={}
    for i in range(1,n+1):
        d1[i]=i
    for i in range(1,m+1):
        d2[i]=i
    l1=[]
    l2=[]
    for i in range(0,n):
        l2=list(map(int,input().split()))
        l1.append(l2)
    for i in range(0,k):
        a,b,c=input().split()
        b=int(b)
        c=int(c)
        if a=='g':
            x=d1[b]
            y=d2[c]
            print(l1[x-1][y-1])
        if a=='c':
            temp=d2[b]
            d2[b]=d2[c]
            d2[c]=temp
        if a=='r':
            temp=d1[b]
            d1[b]=d1[c]
            d1[c]=temp
        
if __name__ == '__main__':
    sync_with_stdio(False)
    main()