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.io.IOException;

import java.util.StringTokenizer;
import java.io.InputStreamReader;
import java.io.BufferedReader;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.math.MathContext;
import java.util.ArrayList;
import java.util.Collections;
import java.util.TreeSet;
import java.util.*;

public class  Main {

    
    public static void main(String[]args)
    {
      
         FastReader in=new FastReader();
      
      int r=in.nextInt();
      
      int c=in.nextInt();
      
      int k=in.nextInt();
      
      int[][]x=new int[r][c];
      
      int[]p=new int[c];
      
      for(int i=0;i<r;i++)
      {
         for(int y=0;y<c;y++)
         {
             x[i][y]=in.nextInt();
             
         }
         
      }
      
      for(int u=0;u<c;u++)
      {
          p[u]=u;
      }
      
      
      StringBuilder sb=new StringBuilder();
      
      while(k-->0)
      {
          String s=in.next();
          
          int a=in.nextInt();
          
          int b=in.nextInt();
          
          if(s.equals("g"))
          {
            sb.append(x[a-1][p[b-1]]+"\n");
          }
          
          else if(s.equals("r"))
          {
              int[]m=x[a-1];
              
              x[a-1]=x[b-1];
              
              x[b-1]=m;
          }
          
          else if(s.equals("c"))
          {
            int e=p[a-1];
            
            p[a-1]=p[b-1];
            
            p[b-1]=e;
          }
      }
      
  
        System.out.print(sb);
    
       
    }
    
    
}




    

    
/* longest common subsequence

Scanner in=new Scanner(System.in);
        
      while(in.hasNextLine()){
      String s=in.next();
      
      String x=in.next();
      
      int l1=s.length();
      
      int l2=x.length();
      
      int[][]e=new int[l1+1][l2+1];
      
      for(int i=0;i<l1+1;i++)
      {
         for(int y=0;y<l2+1;y++)
         {
             if(i==0 || y==0)
             {
                 e[i][y]=0;
             }
             
             else{
             if(s.charAt(i-1)==x.charAt(y-1))
             {
                 e[i][y]=e[i-1][y-1]+1;
             }
             else
             {
                 e[i][y]=Math.max(e[i-1][y],e[i][y-1]);
             }
            }
         }
      }
      
        System.out.println(e[l1][l2]);

*/




//method for prime numbers

/*public static boolean sieve(int n) {
    boolean[]x=new boolean[n+1];
    for(int i = 0; i <= n;++i) {
        x[i] = true;
    }
    x[0] = false;
    x[1] = false;
    for(int i = 2; i * i <= n; ++i) {
         if(x[i] == true) {
             // Mark all the multiples of i as composite numbers
             for(int j = i * i; j <= n ;j += i)
                 x[j] = false;
        }
    }
    
    int i=0;
    
    int count=0;
    while(i<x.length)
    {
        if(x[i] && n%i==0)
            count++;
        
        i++;
    }
    
    return (count==3)?true:false;*/




/* monk is birthday treat

int n=in.nextInt();
       
       int t=in.nextInt();
       
       s=new List[n];
       
       for(int r=0;r<s.length;r++)
       {
           s[r]=new ArrayList();
       }
       
       
       while(t-->0)
       {
           int a=in.nextInt()-1;
           
           int b=in.nextInt()-1;
           s[a].add(b);
       }
       
       long[]p=new long[n];
       
       for(int i=0;i<s.length;i++)
       {
          
          Stack<Integer>e=new Stack();
          int[]k=new int[s[i].size()];
          int j=0;
          if(!s[i].isEmpty()){
              
              boolean []x=new boolean[n]; 
              
           for (Integer h : s[i]) {
               int count=0;
              
               e.add(h);
               
               if(!x[h]){
               x[h]=true;
               count++;
               }
               while(!e.isEmpty())
               {
                   int u=e.pop();
                   
                   for (Integer v : s[u]) {
                       if(!x[v])
                       {
                           x[v]=true;
                           count++;
                           e.add(v);
                       }
                       
                   }
                   
               }
               
               k[j]=count;
               j++;
               
           }
        Arrays.sort(k);
        
        int q=0;
        while(q<k.length)
        {
            if(k[q]!=0)
            {
                p[i]=k[q];
                break;
            }
            q++;
        }
        
        
          }
       }
        Arrays.sort(p);
        int y=0;
        long count2=0;
        while(y<p.length)
        {
           if(p[y]!=0)
           {
              count2=p[y];
              break;
           }
           
           y++;
        }
        System.out.println(count2);

*/

/*class Reader
    {
        final private int BUFFER_SIZE = 1 << 16;
        private DataInputStream din;
        private byte[] buffer;
        private int bufferPointer, bytesRead;
 
        public Reader()
        {
            din = new DataInputStream(System.in);
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }
 
        public Reader(String file_name) throws IOException
        {
            din = new DataInputStream(new FileInputStream(file_name));
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }
 
        public String readLine() throws IOException
        {
            byte[] buf = new byte[64]; // line length
            int cnt = 0, c;
            while ((c = read()) != -1)
            {
                if (c == '\n')
                    break;
                buf[cnt++] = (byte) c;
            }
            return new String(buf, 0, cnt);
        }
 
        public int nextInt() throws IOException
        {
            int ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do
            {
                ret = ret * 10 + c - '0';
            }  while ((c = read()) >= '0' && c <= '9');
 
            if (neg)
                return -ret;
            return ret;
        }
 
        public long nextLong() throws IOException
        {
            long ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do {
                ret = ret * 10 + c - '0';
            }
            while ((c = read()) >= '0' && c <= '9');
            if (neg)
                return -ret;
            return ret;
        }
 
        public double nextDouble() throws IOException
        {
            double ret = 0, div = 1;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
 
            do {
                ret = ret * 10 + c - '0';
            }
            while ((c = read()) >= '0' && c <= '9');
 
            if (c == '.')
            {
                while ((c = read()) >= '0' && c <= '9')
                {
                    ret += (c - '0') / (div *= 10);
                }
            }
 
            if (neg)
                return -ret;
            return ret;
        }
 
        private void fillBuffer() throws IOException
        {
            bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
            if (bytesRead == -1)
                buffer[0] = -1;
        }
 
        private byte read() throws IOException
        {
            if (bufferPointer == bytesRead)
                fillBuffer();
            return buffer[bufferPointer++];
        }
 
        public void close() throws IOException
        {
            if (din == null)
                return;
            din.close();
        }
}*/

class FastReader
    {
        BufferedReader br;
        StringTokenizer st;
 
        public FastReader()
        {
            br = new BufferedReader(new
                     InputStreamReader(System.in));
        }
 
        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException  e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }
 
        int nextInt()
        {
            return Integer.parseInt(next());
        }
 
        long nextLong()
        {
            return Long.parseLong(next());
        }
 
        double nextDouble()
        {
            return Double.parseDouble(next());
        }
 
        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
}