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.

Input

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 ≤ 106.

Next k lines contain queries in the format "si xi yi", where si is one of the characters "с", "r" or "g", and xi, yi are two integers.

  * If si = "c", then the current query is the query to swap columns with indexes xi and yi (1 ≤ x, y ≤ m, x ≠ y); 
  * If si = "r", then the current query is the query to swap rows with indexes xi and yi (1 ≤ x, y ≤ n, x ≠ y); 
  * If si = "g", then the current query is the query to obtain the number that located in the xi-th row and in the yi-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.

Output

For each query to obtain a number (si = "g") print the required number. Print the answers to the queries in the order of the queries in the input.

Examples

Input

3 3 5
1 2 3
4 5 6
7 8 9
g 3 2
r 3 2
c 2 3
g 2 2
g 3 2


Output

8
9
6


Input

2 3 3
1 2 4
3 1 5
c 2 1
r 1 2
g 1 3


Output

5

Note

Let's see how the table changes in the second test case.

After the first operation is fulfilled, the table looks like that:

2 1 4

1 3 5

After the second operation is fulfilled, the table looks like that:

1 3 5

2 1 4

So the answer to the third query (the number located in the first row and in the third column) will be 5.
import java.text.DecimalFormat;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import java.io.*;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.math.MathContext;

import static java.lang.Math.*;
import static java.util.Arrays.*;
import static java.util.Arrays.fill;
import static java.util.Collections.*;

public class Main {
    public static void main(String[] args) throws Exception {
        InputReader in = new InputReader(System.in);
        PrintWriter out = new PrintWriter(System.out);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskA {
        int[] dx = {1, 0, -1, 0, -1, -1, 1, 1},
                dy = {0, 1, 0, -1, -1, 1 - 1, 1};
        int MAX = (int) (1e5 + 10);

        // GCD && LCM
        long gcd(long a, long b) {
            return b == 0 ? a : gcd(b, a % b);
        }

        long lcm(long a, long b) {
            return a * (b / gcd(a, b));
        }

        // REverse a String
        String rev(String s) {
            return new StringBuilder(s).reverse().toString();
        }


        /*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SOLUTION IS RIGHT HERE^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/
        public void solve(int testNumber, InputReader in, PrintWriter out) throws IOException {
            int x = in.nextInt(),y = in.nextInt(),q = in.nextInt(),
            		r[] = new int[x],c[] = new int[y],g[][] = new int[x][y];
            for(int i = 0; i < x; i++)
            {
            	r[i] = i;
            	g[i] = in.readintArray(y);
            }
            for(int i = 0; i < y; i++)
            	c[i] = i;
            
            while(q-->0){
            	char ch = in.next().charAt(0);
            	int a = in.nextInt()-1, b = in.nextInt()-1;
            	if(ch == 'c'){
            		int ss = c[a];
            		c[a] = c[b];
            		c[b] = ss;
            	}else if(ch == 'r'){
            		int ss = r[a];
            		r[a] = r[b];
            		r[b] = ss;
            	}else{
            		out.println(g[r[a]][c[b]]);
            	}
            }
        }
    }
    static class pair implements Comparable<pair>{
        public Integer x,y,total;
        public pair(int x,int y,int z){
            this.x = x;
            this.y = y;
            this.total = z;
        }
        public pair(){x=0; y=0; total = x+y;}
        public int compareTo(pair that) {
            if(this.x != that.x)
                return this.x.compareTo(that.x);
            else
                return this.y.compareTo(that.y);
        }
    }
    /*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^`````````````````````````^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/
    static class InputReader {
        private byte[] buf = new byte[8000];
        private int index;
        private int total;
        private InputStream in;
        // BufferedReader br = new BufferedReader(new
        // InputStreamReader(System.in));

        public InputReader(InputStream stream) {
            in = stream;
        }

        public int scan() {
            if (total == -1)
                throw new InputMismatchException();
            if (index >= total) {
                index = 0;
                try {
                    total = in.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (total <= 0)
                    return -1;
            }
            return buf[index++];
        }

        public long scanlong() {
            long integer = 0;
            int n = scan();
            while (isWhiteSpace(n))
                n = scan();
            int neg = 1;
            if (n == '-') {
                neg = -1;
                n = scan();
            }
            while (!isWhiteSpace(n)) {
                if (n >= '0' && n <= '9') {
                    integer *= 10;
                    integer += n - '0';
                    n = scan();
                } else
                    throw new InputMismatchException();
            }
            return neg * integer;
        }

        private int scanInt() {
            int integer = 0;
            int n = scan();
            while (isWhiteSpace(n))
                n = scan();
            int neg = 1;
            if (n == '-') {
                neg = -1;
                n = scan();
            }
            while (!isWhiteSpace(n)) {
                if (n >= '0' && n <= '9') {
                    integer *= 10;
                    integer += n - '0';
                    n = scan();
                } else
                    throw new InputMismatchException();
            }
            return neg * integer;
        }

        public double scandouble() {
            double doubll = 0;
            int n = scan();
            int neg = 1;
            while (isWhiteSpace(n))
                n = scan();
            if (n == '-') {
                neg = -1;
                n = scan();
            }
            while (!isWhiteSpace(n) && n != '.') {
                if (n >= '0' && n <= '9') {
                    doubll *= 10;
                    doubll += n - '0';
                    n = scan();
                }
            }
            if (n == '.') {
                n = scan();
                double temp = 1;
                while (!isWhiteSpace(n)) {
                    if (n >= '0' && n <= '9') {
                        temp /= 10;
                        doubll += (n - '0') * temp;
                        n = scan();
                    }
                }
            }
            return neg * doubll;
        }

        private float scanfloat() {
            float doubll = 0;
            int n = scan();
            int neg = 1;
            while (isWhiteSpace(n))
                n = scan();
            if (n == '-') {
                neg = -1;
                n = scan();
            }
            while (!isWhiteSpace(n) && n != '.') {
                if (n >= '0' && n <= '9') {
                    doubll *= 10;
                    doubll += n - '0';
                    n = scan();
                }
            }
            if (n == '.') {
                n = scan();
                double temp = 1;
                while (!isWhiteSpace(n)) {
                    if (n >= '0' && n <= '9') {
                        temp /= 10;
                        doubll += (n - '0') * temp;
                        n = scan();
                    }
                }
            }
            return neg * doubll;
        }

        public String scanstring() {
            StringBuilder sb = new StringBuilder();
            int n = scan();
            while (isWhiteSpace(n))
                n = scan();
            while (!isWhiteSpace(n)) {
                sb.append((char) n);
                n = scan();
            }
            return sb.toString();
        }

        public String scan_nextLine() {
            int n = scan();
            while (isWhiteSpace(n))
                n = scan();
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(n);
                n = scan();
            } while (!isEndOfLine(n));
            return res.toString();
        }

        public boolean isWhiteSpace(int n) {
            if (n == ' ' || n == '\n' || n == '\r' || n == '\t' || n == -1)
                return true;
            return false;
        }

        private boolean isEndOfLine(int c) {
            return c == '\n' || c == '\r' || c == -1;
        }
        /// Input module

        public int nextInt() {
            return scanInt();
        }

        public long nextLong() {
            return scanlong();
        }

        public double nextDouble() {
            return scandouble();
        }

        public float nextFloat() {
            return scanfloat();
        }

        public String next() {
            return scanstring();
        }

        public String nextLine() throws IOException {
            return scan_nextLine();
        }

        public int[] readintArray(int size) {
            int[] array = new int[size];
            for (int i = 0; i < size; i++) {
                array[i] = nextInt();
            }
            return array;
        }

        public Integer[] readIntegerArray(int size) {
            Integer[] array = new Integer[size];
            for (int i = 0; i < size; i++) {
                array[i] = nextInt();
            }
            return array;
        }
    }

} 