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.
//package com.morazow.cf;

import java.io.*;
import java.util.*;

public class CF222B {

    public static void main(String[] args) {
        ArrayBufferScanner scanner = new ArrayBufferScanner(System.in);
        PrintWriter output = new PrintWriter(new OutputStreamWriter(System.out));

        int N = scanner.nextInt();
        int M = scanner.nextInt();
        int K = scanner.nextInt();

        int[][] matrix = new int[N][M];
        for (int i = 0; i < N; i++) {
            for (int j = 0; j < M; j++) {
                matrix[i][j] = scanner.nextInt();
            }
        }

        int[] rows = new int[N];
        for (int i = 0; i < N; i++) {
            rows[i] = i;
        }
        int[] cols = new int[M];
        for (int i = 0; i < M; i++) {
            cols[i] = i;
        }

        for (int i = 0; i < K; i++) {
            char ch = scanner.next().charAt(0);
            int r = scanner.nextInt() - 1;
            int c = scanner.nextInt() - 1;
            if (ch == 'r') {
                swap(rows, r, c);
            } else if (ch == 'c') {
                swap(cols, r, c);
            } else {
                output.println(matrix[rows[r]][cols[c]]);
            }
        }

        output.close();
    }

    private static void swap(int[] A, int i, int j) {
        int t = A[i]; A[i] = A[j]; A[j] = t;
    }

    private static class ArrayBufferScanner {
        private char[] buffer = new char[1 << 4];
        private int pos = 1;

        private BufferedReader reader;

        public ArrayBufferScanner(InputStream in) {
            this.reader = new BufferedReader(new InputStreamReader(in));
        }

        public boolean hasNext() {
            return pos > 0;
        }

        public String next() {
            loadBuffer();
            return current();
        }

        public int nextInt() {
            loadBuffer();
            final int radix = 10;
            int result = 0;
            int i = buffer[0] == '-' || buffer[0] == '+' ? 1 : 0;
            for (checkValidNumber(pos > i); i < pos; i++) {
                int digit = buffer[i] - '0';
                checkValidNumber(0 <= digit && digit <= 9);
                result = result * radix + digit;
            }
            return buffer[0] == '-' ? -result : result;
        }

        private void checkValidNumber(boolean condition) {
            if (!condition) {
                throw new NumberFormatException(current());
            }
        }

        private void loadBuffer() {
            pos = 0;
            try {
                for (int i; (i = reader.read()) != -1; ) {
                    char c = (char) i;
                    if (c != ' ' && c != '\n' && c != '\t' && c != '\r' && c != '\f') {
                        if (pos == buffer.length) {
                            buffer = Arrays.copyOf(buffer, 2 * pos);
                        }
                        buffer[pos++] = c;
                    } else if (pos != 0) {
                        break;
                    }
                }
            } catch (IOException e) {
                throw new UncheckedIOException(e);
            }
        }

        private String current() {
            return String.copyValueOf(buffer, 0, pos);
        }
    }

}
