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.util.*;
import java.lang.*;
import java.io.*;
public class Codechef
{   static PrintWriter out=new PrintWriter(System.out);
	static FastScanner in = new FastScanner(System.in);
     static class FastScanner {
        BufferedReader br;
        StringTokenizer stok;
        FastScanner(InputStream is) {
            br = new BufferedReader(new InputStreamReader(is));
        }
        String next() throws IOException {
            while (stok == null || !stok.hasMoreTokens()) {
                String s = br.readLine();
                if (s == null) {
                    return null;
                }
                stok = new StringTokenizer(s);
            }
            return stok.nextToken();
        }
        int ni() throws IOException {
            return Integer.parseInt(next());
        }
        long nl() throws IOException {
            return Long.parseLong(next());
        }
        double nd() throws IOException {
            return Double.parseDouble(next());
        }
        char nc() throws IOException {
            return (char) (br.read());
        }
        String ns() throws IOException {
            return br.readLine();
        }
        int[] nia(int n) throws IOException{
            int a[] = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = ni();
            }
            return a;
        }
        long[] nla(int n) throws IOException {
            long a[] = new long[n];
            for (int i = 0; i < n; i++)
                a[i] = nl();
            return a;
        }
        double[] nda(int n)throws IOException {
            double a[] = new double[n];
            for (int i = 0; i < n; i++)
                a[i] = nd();
            return a;
        }
        int [][] imat(int n,int m) throws IOException
        {   int mat[][]=new int[n][m];
            for(int i=0;i<n;i++)
            {   for(int j=0;j<m;j++)
                   mat[i][j]=ni();
            }
            return mat;
        }
    }
    
    ///     PRINTING FUNCTIONS
    
    static void pia(int arr[]) throws IOException
        {   for(int i=0;i<arr.length;i++)
                out.print(arr[i]+" ");
            out.println();
        }
    static void pla(long arr[]) throws IOException
        {   for(int i=0;i<arr.length;i++)
                out.print(arr[i]+" ");
            out.println();
        }
    static void pimat(int mat[][])
        {   for(int i=0;i<mat.length;i++)
            {   for(int j=0;j<mat[0].length;j++)
                    out.print(mat[i][j]);
            out.println();
        }
    }
        
    ///MAIN METHOD
    
    
    
    
	static long mod=Long.MAX_VALUE;
	public static void main (String[] args) throws java.lang.Exception
	{   int i,j;
	    HashMap<Integer,Integer> hm=new HashMap<Integer,Integer>();
		/*  if(hm.containsKey(z))
		        hm.put(z,hm.get(z)+1);
		    else
		        hm.put(z,1);
		 */       
        ArrayList<Integer> arr=new ArrayList<Integer>();
        HashSet<Integer> set=new HashSet<Integer>();
        PriorityQueue<Integer> pq=new PriorityQueue<Integer>();
        /*  int n = in.ni();
            int m = in.ni();
            String s=in.ns();
            int a[]=in.nia(n);
            int b[][]=in.imat(n,m);
            pia(a);
		    pimat(b);
		
        */
        int n=in.ni();
        int m=in.ni();
        int k=in.ni();
        int a[][]=in.imat(n,m);
		ArrayList<Integer> arr_r[]=new ArrayList[n+1];
		   ArrayList<Integer> arr_c[]=new ArrayList[m+1];
		   //out.println(c+" "+p+" "+q);
		   for(i=0;i<=n;i++)
		    {   arr_r[i]=new ArrayList<Integer>();
		        arr_r[i].add(i);
		    }  
		    for(i=0;i<=m;i++)
		    {   arr_c[i]=new ArrayList<Integer>();
		        arr_c[i].add(i);
		    }
		 
		while(k--!=0)
		{
		   char c=in.nc(); 
		   int p=in.ni();
		   int q=in.ni();
		   if(c=='r')
		   {   int x=arr_r[p].get(arr_r[p].size()-1);
		       int y=arr_r[q].get(arr_r[q].size()-1);
		       arr_r[p].add(y);
		       arr_r[q].add(x);
		                
		   }
		   else if(c=='c')
		   {   int x=arr_c[p].get(arr_c[p].size()-1);
		       int y=arr_c[q].get(arr_c[q].size()-1);
		       arr_c[p].add(y);
		       arr_c[q].add(x);     
		   }
		   else
		    {
		        int x=arr_r[p].size(); 
		       int y=arr_c[q].size(); 
		        int g=arr_r[p].get(x-1);
		        int h=arr_c[q].get(y-1);
		       //for(i=1;i<=n;i++)
		       //    out.println(arr_r[i]);
		        
		       //for(i=1;i<=m;i++)
		        //  out.println(arr_c[i]);
		              
		        //out.println(arr_r[p].get(x-1)+" "+arr_c[q].get(y-1));
		        out.println(a[g-1][h-1]);
		    }
		    
		   
		}
		
		
		
		
		
		
		
		out.close();
	}
	
	
	
	
	
	static long gcd(long a,long b)
	{   if(b==0)
	        return a;
	    return gcd(b,a%b);    
    	}
	static long exponent(long a,long n)
	{   long ans=1;
	    while(n!=0)
	    {   if(n%2==0)
	            ans=(ans*a)%mod;
	       a=(a*a)%mod;
	       n=n>>1;
	    }
	    return ans;
	}
	static int binarySearch(int a[], int item, int low, int high) 
    {   if (high <= low) 
            return (item > a[low])?  (low + 1): low; 
        int mid = (low + high)/2; 
        if(item == a[mid]) 
            return mid+1; 
        if(item > a[mid]) 
            return binarySearch(a, item, mid+1, high); 
        return binarySearch(a, item, low, mid-1); 
    } 
}