#include <bits/stdc++.h>
using namespace std;
class value {
 public:
  int num, nextxx, nextxy, nextyx, nextyy;
  value() : num(0), nextxx(-1), nextxy(-1), nextyx(-1), nextyy(-1) {}
  void swap_down(value& other) {
    swap(nextxx, other.nextxx);
    swap(nextxy, other.nextxy);
  }
  void swap_right(value& other) {
    swap(nextyx, other.nextyx);
    swap(nextyy, other.nextyy);
  }
};
vector<vector<value> > v;
void right(int& x, int& y) {
  int nx = v[x][y].nextyx, ny = v[x][y].nextyy;
  x = nx;
  y = ny;
}
void down(int& x, int& y) {
  int nx = v[x][y].nextxx, ny = v[x][y].nextxy;
  x = nx;
  y = ny;
}
void get(int& x, int& y, int nx, int ny) {
  for (int i = 0; i < ny; i++) right(x, y);
  for (int i = 0; i < nx; i++) down(x, y);
}
void vypis(int n, int m) {
  vector<pair<int, int> > p(m + 1);
  p[0] = {0, 0};
  for (int i = 1; i <= m; i++) {
    p[i] = p[i - 1];
    right(p[i].first, p[i].second);
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      down(p[j].first, p[j].second);
      cout << v[p[j].first][p[j].second].num << " ";
    }
    cout << "\n";
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, m, q;
  cin >> n >> m >> q;
  v.resize(n + 1, vector<value>(m + 1));
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) cin >> v[i + 1][j + 1].num;
  for (int i = 0; i <= n; i++) {
    for (int j = 0; j <= m; j++) {
      if (i < n) {
        v[i][j].nextxx = i + 1;
        v[i][j].nextxy = j;
      }
      if (j < m) {
        v[i][j].nextyx = i;
        v[i][j].nextyy = j + 1;
      }
    }
  }
  while (q--) {
    int x1, y1, x2, y2, h, w;
    cin >> x1 >> y1 >> x2 >> y2 >> h >> w;
    vector<pair<int, int> > p11(w), p21(w), p12(h), p22(h), p13(w), p23(w),
        p14(h), p24(h);
    get(p11[0].first, p11[0].second, x1 - 1, y1);
    get(p21[0].first, p21[0].second, x2 - 1, y2);
    get(p12[0].first, p12[0].second, x1, y1 - 1);
    get(p22[0].first, p22[0].second, x2, y2 - 1);
    get(p13[0].first, p13[0].second, x1 + h - 1, y1);
    get(p23[0].first, p23[0].second, x2 + h - 1, y2);
    get(p14[0].first, p14[0].second, x1, y1 + w - 1);
    get(p24[0].first, p24[0].second, x2, y2 + w - 1);
    for (int i = 1; i < w; i++) {
      p11[i] = p11[i - 1];
      right(p11[i].first, p11[i].second);
      p21[i] = p21[i - 1];
      right(p21[i].first, p21[i].second);
      p13[i] = p13[i - 1];
      right(p13[i].first, p13[i].second);
      p23[i] = p23[i - 1];
      right(p23[i].first, p23[i].second);
    }
    for (int i = 1; i < h; i++) {
      p12[i] = p12[i - 1];
      down(p12[i].first, p12[i].second);
      p22[i] = p22[i - 1];
      down(p22[i].first, p22[i].second);
      p14[i] = p14[i - 1];
      down(p14[i].first, p14[i].second);
      p24[i] = p24[i - 1];
      down(p24[i].first, p24[i].second);
    }
    for (int i = 0; i < w; i++) {
      v[p11[i].first][p11[i].second].swap_down(v[p21[i].first][p21[i].second]);
      v[p13[i].first][p13[i].second].swap_down(v[p23[i].first][p23[i].second]);
    }
    for (int i = 0; i < h; i++) {
      v[p12[i].first][p12[i].second].swap_right(v[p22[i].first][p22[i].second]);
      v[p14[i].first][p14[i].second].swap_right(v[p24[i].first][p24[i].second]);
    }
  }
  vypis(n, m);
  return 0;
}
