#include<bits/stdc++.h>
using namespace std;
int yt=1; //test variable
bool qf=false; //fast io enabled/disabled
#define input freopen("in.txt","r",stdin);
#define output freopen("out.txt","w",stdout);
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);qf=true;
#define sc scanf
#define pr printf
#define whi while
#define ll long long
#define ull unsigned long long
#define lld I64d
#define mp make_pair
#define ff first
#define ss second
#define vc vector
#define pb push_back
#define ite iterator
#define str string
#define bl bool
#define tr true
#define fl false
#define endl '\n'
#define ret return
#define rsort greater<int>()
#define nl if(qf==tr) pr("\n");else cout<<"\n";
#define test if(qf==tr) pr("TEST %d\n",yt++);else cout<<"TEST "<<yt++<<"\n";
#define gcd(a,b) __gcd(a,b)
#define mod 1000000007
#define all(c) c.begin(),c.end()
#define sz(c) c.size()
#define clr(c) c.clear()
#define fd(c,a) c.find(a)
#define bg(c) c.begin()
#define ed(c) c.end()
#define ins(c,a) c.insert(a)
#define rem(c,a) c.erase(a)
#define si(n) if(qf==fl) sc("%d",&n); else cin>>n;
#define sll(n) if(qf==fl) sc("%lld",&n); else cin>>n;
#define pi(n) if(qf==fl) pr("%d ",n); else cout<<n<<" ";
#define pll(n) if(qf==fl) pr("%lld ",n); else cout<<n<<" ";
#define tc int t;if(qf==fl) si(t) else cin>>t;whi(t--)
#define ct continue;
#define debug system("PAUSE");
int a[109][109];
pair <int,int> temp[109][109];
int main()
{
int i,j,n,m,q,ch;
sc("%d%d%d",&n,&m,&q);
for(i=0;i<n;i++)
{
for(j=0;j<m;j++)
{
temp[i][j].ff=i;
temp[i][j].ss=j;
}
}
int pos,t1,t2,r,c,val;
whi(q--)
{
sc("%d",&ch);
if(ch==1) //row shift
{
sc("%d",&pos);
pos--;
t1=temp[pos][0].ff;
t2=temp[pos][0].ss;
for(i=0;i<m-1;i++)
{
temp[pos][i].ff=temp[pos][i+1].ff;
temp[pos][i].ss=temp[pos][i+1].ss;
}
temp[pos][m-1].ff=t1;
temp[pos][m-1].ss=t2;
}
else if(ch==2) //column shift
{
sc("%d",&pos);
pos--;
t1=temp[0][pos].ff;
t2=temp[0][pos].ss;
for(i=0;i<n-1;i++)
{
temp[i][pos].ff=temp[i+1][pos].ff;
temp[i][pos].ss=temp[i+1][pos].ss;
}
temp[n-1][pos].ff=t1;
temp[n-1][pos].ss=t2;
}
else
{
sc("%d%d%d",&r,&c,&val);
r--;
c--;
a[temp[r][c].ff][temp[r][c].ss]=val;
}
}
for(i=0;i<n;i++)
{
for(j=0;j<m;j++) pr("%d ",a[i][j]);
nl
}
ret 0;
}
I2luY2x1ZGU8Yml0cy9zdGRjKysuaD4KdXNpbmcgbmFtZXNwYWNlIHN0ZDsKaW50IHl0PTE7ICAgICAgICAgICAvL3Rlc3QgdmFyaWFibGUKYm9vbCBxZj1mYWxzZTsgICAgICAvL2Zhc3QgaW8gZW5hYmxlZC9kaXNhYmxlZAoKI2RlZmluZSBpbnB1dCAgICAgICBmcmVvcGVuKCJpbi50eHQiLCJyIixzdGRpbik7CiNkZWZpbmUgb3V0cHV0ICAgICAgZnJlb3Blbigib3V0LnR4dCIsInciLHN0ZG91dCk7CiNkZWZpbmUgZmFzdCAgICAgICAgaW9zX2Jhc2U6OnN5bmNfd2l0aF9zdGRpbyhmYWxzZSk7Y2luLnRpZSgwKTtjb3V0LnRpZSgwKTtxZj10cnVlOwoKI2RlZmluZSBzYyAgICAgICAgICBzY2FuZgojZGVmaW5lIHByICAgICAgICAgIHByaW50ZgojZGVmaW5lIHdoaSAgICAgICAgIHdoaWxlCiNkZWZpbmUgbGwgICAgICAgICAgbG9uZyBsb25nCiNkZWZpbmUgdWxsICAgICAgICAgdW5zaWduZWQgbG9uZyBsb25nCiNkZWZpbmUgbGxkICAgICAgICAgSTY0ZAojZGVmaW5lIG1wICAgICAgICAgIG1ha2VfcGFpcgojZGVmaW5lIGZmICAgICAgICAgIGZpcnN0CiNkZWZpbmUgc3MgICAgICAgICAgc2Vjb25kCiNkZWZpbmUgdmMgICAgICAgICAgdmVjdG9yCiNkZW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PWZsKSBwcigiJWQgIixuKTsgZWxzZSBjb3V0PDxuPDwiICI7CiNkZWZpbmUgcGxsKG4pICAgICAgaWYocWY9PWZsKSBwcigiJWxsZCAiLG4pOyBlbHNlIGNvdXQ8PG48PCIgIjsKCiNkZWZpbmUgdGMgICAgICAgICAgaW50IHQ7aWYocWY9PWZsKSBzaSh0KSBlbHNlIGNpbj4+dDt3aGkodC0tKQojZGVmaW5lIGN0ICAgICAgICAgIGNvbnRpbnVlOwojZGVmaW5lIGRlYnVnICAgICAgIHN5c3RlbSgiUEFVU0UiKTsKaW50IGFbMTA5XVsxMDldOwpwYWlyIDxpbnQsaW50PiB0ZW1wWzEwOV1bMTA5XTsKaW50IG1haW4oKQp7CiAgICBpbnQgaSxqLG4sbSxxLGNoOwogICAgc2MoIiVkJWQlZCIsJm4sJm0sJnEpOwogICAgZm9yKGk9MDtpPG47aSsrKQogICAgewogICAgICAgIGZvcihqPTA7ajxtO2orKykKICAgICAgICB7CiAgICAgICAgICAgIHRlbXBbaV1bal0uZmY9aTsKICAgICAgICAgICAgdGVtcFtpXVtqXS5zcz1qOwogICAgICAgIH0KICAgIH0KICAgIGludCBwb3MsdDEsdDIscixjLHZhbDsKICAgIHdoaShxLS0pCiAgICB7CiAgICAgICAgc2MoIiVkIiwmY2gpOwogICAgICAgIGlmKGNoPT0xKSAvL3JvdyBzaGlmdAogICAgICAgIHsKICAgICAgICAgICAgc2MoIiVkIiwmcG9zKTsKICAgICAgICAgICAgcG9zLS07CiAgICAgICAgICAgIHQxPXRlbXBbcG9zXVswXS5mZjsKICAgICAgICAgICAgdDI9dGVtcFtwb3NdWzBdLnNzOwogICAgICAgICAgICBmb3IoaT0wO2k8bS0xO2krKykKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgdGVtcFtwb3NdW2ldLmZmPXRlbXBbcG9zXVtpKzFdLmZmOwogICAgICAgICAgICAgICAgdGVtcFtwb3NdW2ldLnNzPXRlbXBbcG9zXVtpKzFdLnNzOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHRlbXBbcG9zXVttLTFdLmZmPXQxOwogICAgICAgICAgICB0ZW1wW3Bvc11bbS0xXS5zcz10MjsKICAgICAgICB9CiAgICAgICAgZWxzZSBpZihjaD09MikgLy9jb2x1bW4gc2hpZnQKICAgICAgICB7CiAgICAgICAgICAgIHNjKCIlZCIsJnBvcyk7CiAgICAgICAgICAgIHBvcy0tOwogICAgICAgICAgICB0MT10ZW1wWzBdW3Bvc10uZmY7CiAgICAgICAgICAgIHQyPXRlbXBbMF1bcG9zXS5zczsKICAgICAgICAgICAgZm9yKGk9MDtpPG4tMTtpKyspCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIHRlbXBbaV1bcG9zXS5mZj10ZW1wW2krMV1bcG9zXS5mZjsKICAgICAgICAgICAgICAgIHRlbXBbaV1bcG9zXS5zcz10ZW1wW2krMV1bcG9zXS5zczsKICAgICAgICAgICAgfQogICAgICAgICAgICB0ZW1wW24tMV1bcG9zXS5mZj10MTsKICAgICAgICAgICAgdGVtcFtuLTFdW3Bvc10uc3M9dDI7CiAgICAgICAgfQogICAgICAgIGVsc2UKICAgICAgICB7CiAgICAgICAgICAgIHNjKCIlZCVkJWQiLCZyLCZjLCZ2YWwpOwogICAgICAgICAgICByLS07CiAgICAgICAgICAgIGMtLTsKICAgICAgICAgICAgYVt0ZW1wW3JdW2NdLmZmXVt0ZW1wW3JdW2NdLnNzXT12YWw7CiAgICAgICAgfQogICAgfQogICAgZm9yKGk9MDtpPG47aSsrKQogICAgewogICAgICAgIGZvcihqPTA7ajxtO2orKykgcHIoIiVkICIsYVtpXVtqXSk7CiAgICAgICAgbmwKICAgIH0KICAgIHJldCAwOwp9Cg==