#include <bits/stdc++.h>
using namespace std;
int n, m, q;
inline int encode(int a, int b) { return (a * (m + 1) + b); }
int val[1050][1050];
int ri[1050 * 1050 + 100], dw[1050 * 1050 + 100];
int main() {
  scanf("%d%d%d", &n, &m, &q);
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) scanf("%d", val[i] + j);
  for (int i = 0; i < n + 1; i++)
    for (int j = 0; j < m + 1; j++)
      ri[encode(i, j)] = encode(i, j + 1), dw[encode(i, j)] = encode(i + 1, j);
  while (q--) {
    int a, b, c, d, h, w;
    scanf("%d%d%d%d%d%d", &a, &b, &c, &d, &h, &w);
    a--;
    b--;
    c--;
    d--;
    int pt1, pt2;
    int tpt1 = a * (m + 1);
    for (int i = 0; i < b; i++) tpt1 = ri[tpt1];
    int tpt2 = c * (m + 1);
    for (int i = 0; i < d; i++) tpt2 = ri[tpt2];
    pt1 = tpt1;
    pt2 = tpt2;
    for (int i = 0; i < h; i++) {
      pt1 = dw[pt1];
      pt2 = dw[pt2];
      swap(ri[pt1], ri[pt2]);
    }
    for (int i = 0; i < w; i++) {
      pt1 = ri[pt1];
      pt2 = ri[pt2];
      swap(dw[pt1], dw[pt2]);
    }
    pt1 = tpt1;
    pt2 = tpt2;
    for (int i = 0; i < w; i++) {
      pt1 = ri[pt1];
      pt2 = ri[pt2];
      swap(dw[pt1], dw[pt2]);
    }
    for (int i = 0; i < h; i++) {
      pt1 = dw[pt1];
      pt2 = dw[pt2];
      swap(ri[pt1], ri[pt2]);
    }
  }
  int cur = 0;
  for (int i = i = 1; i <= n; i++) {
    cur = dw[cur];
    int t = cur;
    for (int j = 1; j <= m; j++) {
      t = ri[t];
      printf("%d%s", val[t / (m + 1)][t % (m + 1)], (j == m) ? "\n" : " ");
    }
  }
}
